是否可以在运行时将文本块插入图像? [英] Is it possible to insert a text block into an image on runtime?

查看:61
本文介绍了是否可以在运行时将文本块插入图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在运行时将文本块插入图像?如果是,请分享代码

Is it possible to insert a text block into an image on runtime? If it is, Kindly share the code

推荐答案

是的,您可以在图像上放置文本块。请考虑以下内容

XAML

Yes, you can place a text block over an image. Consider the following
XAML
<window x:class="MyProject.MainWindow" 

        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

        Title="MainWindow" Height="350" Width="525">
    <grid name="mygrid">

    </grid>
</window>



C#


C#

public partial class MainWindow : Window {
   public MainWindow() {
      InitializeComponent();

      mygrid.Children.Add(
         new System.Windows.Controls.Frame() {
            Background = Brushes.Tomato });
      mygrid.Children.Add(
         new System.Windows.Controls.TextBlock() {
            Text = "Here goes my text",
            Margin = new Thickness(50, 50, 0, 0) });
   }
}


这篇关于是否可以在运行时将文本块插入图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆