@@ -65,14 +65,12 @@ You can add text to an image using the AddText method programmatically. This met
6565* TextSettings - Customizes the text.
6666
6767{% tabs %}
68-
6968{% highlight XAML %}
7069
7170<editor: SfImageEditor x: Name ="editor"
7271 Loaded="OnImageEditorLoaded">
7372
7473{% endhighlight %}
75-
7674{% highlight C# hl_lines="3" %}
7775
7876private void OnImageEditorLoaded(object sender, RoutedEventArgs e)
@@ -81,7 +79,6 @@ private void OnImageEditorLoaded(object sender, RoutedEventArgs e)
8179}
8280
8381{% endhighlight %}
84-
8582{% endtabs %}
8683
8784## Text settings
@@ -101,42 +98,39 @@ Using the following properties in TextSettings, text can be customized.
10198> N Values of bounds will be in percentage. For example (25, 25, 25, 25) will take the position of 25 percent from the left and top.
10299
103100{% tabs %}
104-
105101{% highlight XAML %}
106102
107- <editor:SfImageEditor x:Name="editor"
108- Loaded="OnImageEditorLoaded">
103+ <editor: SfImageEditor x: Name ="editor"
104+ Loaded="OnImageEditorLoaded">
109105
110106{% endhighlight %}
111-
112107{% highlight C# %}
113108
114- this.editor.Loaded += OnImageEditorLoaded;
115-
116- private void OnImageEditorLoaded(object sender, RoutedEventArgs e)
117- {
118- TextSettings textSettings = new TextSettings();
119- textSettings.Background = new SolidColorBrush(Colors.Yellow);
120- textSettings.FontFamily = new FontFamily("Century Schoolbook");
121- textSettings.FontSize = 30;
122- textSettings.Color = new SolidColorBrush(Colors.Red);
123- textSettings.TextEffects = TextEffects.Bold | TextEffects.Italic;
124- textSettings.Bounds = new Rect(50, 10, 50, 15);
125- this.editor.AddText("Good morning", textSettings);
126-
127- textSettings = new TextSettings();
128- textSettings.Background = new SolidColorBrush(Colors.Ivory);
129- textSettings.FontFamily = new FontFamily("Bell MT");
130- textSettings.FontSize = 22;
131- textSettings.Color = new SolidColorBrush(Colors.DarkGreen);
132- textSettings.TextEffects = TextEffects.Italic;
133- textSettings.Bounds = new Rect(50, 23, 30, 15);
134- textSettings.TextAlignment = TextAlignment.Center;
135- this.editor.AddText("The happiness of your \nlife depend upon the \nquality of your thoughts.", textSettings);
136- }
109+ this.editor.Loaded += OnImageEditorLoaded;
137110
138- {% endhighlight %}
111+ private void OnImageEditorLoaded(object sender, RoutedEventArgs e)
112+ {
113+ TextSettings textSettings = new TextSettings();
114+ textSettings.Background = new SolidColorBrush(Colors.Yellow);
115+ textSettings.FontFamily = new FontFamily("Century Schoolbook");
116+ textSettings.FontSize = 30;
117+ textSettings.Color = new SolidColorBrush(Colors.Red);
118+ textSettings.TextEffects = TextEffects.Bold | TextEffects.Italic;
119+ textSettings.Bounds = new Rect(50, 10, 50, 15);
120+ this.editor.AddText("Good morning", textSettings);
121+
122+ textSettings = new TextSettings();
123+ textSettings.Background = new SolidColorBrush(Colors.Ivory);
124+ textSettings.FontFamily = new FontFamily("Bell MT");
125+ textSettings.FontSize = 22;
126+ textSettings.Color = new SolidColorBrush(Colors.DarkGreen);
127+ textSettings.TextEffects = TextEffects.Italic;
128+ textSettings.Bounds = new Rect(50, 23, 30, 15);
129+ textSettings.TextAlignment = TextAlignment.Center;
130+ this.editor.AddText("The happiness of your \nlife depend upon the \nquality of your thoughts.", textSettings);
131+ }
139132
133+ {% endhighlight %}
140134{% endtabs %}
141135
142136![ Text] ( Images/Text.jpg )
0 commit comments