سلام بر تمامی برنامه نویسان #C 😉 در این پست کد highlight متن نمایش داده شده و استفاده از PathGeometry با wpf و سی شارپ را آماده کردم. انشاالله که این کد براتون مفید باشه.
تصویر خروجی این کد:
کد highlight متن نمایش داده شده و استفاده از PathGeometry با wpf و سی شارپ :
<button>Display Text</button>
<canvas height="150">
</canvas>
//File:Window.xaml.cs
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Media;
namespace WpfApplication1
{
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
}
public void OnDisplayTextClick(object sender, EventArgs e)
{
FormattedText formattedText = new FormattedText(
"asdf",
CultureInfo.GetCultureInfo("en-us"),
FlowDirection.LeftToRight,
new Typeface("Verdana"),
96,
Brushes.Black);
<canvas height="150">
</canvas>
//File:Window.xaml.cs
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Media;
namespace WpfApplication1
{
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
}
public void OnDisplayTextClick(object sender, EventArgs e)
{
FormattedText formattedText = new FormattedText(
"asdf",
CultureInfo.GetCultureInfo("en-us"),
FlowDirection.LeftToRight,
new Typeface("Verdana"),
96,
Brushes.Black);