This evening, I have prepared a very interesting thing for you. I believe that you have also used hand-written input or drawing software when using MS Office, there should be no stranger to hand-writing perception, especially mobile phones. Many hosts have touch-screen handwriting functions.
In the past, it was very painful to implement the hand-drawn feature. However, it is good news that you can easily implement this feature in WPF. Believe it or not, I believe it. Come on, try it.
Create a new WPF Application and add the following XAML to the Grid:
[Html]
<Grid>
<InkCanvas x: Name = "icv" Margin = "1"/>
</Grid>
OK. Run it now.
How are you afraid to believe it? That's easy!
Surprise?
To continue.
InkCanvas can contain sub-elements, that is, we can "Crow" on other visual objects ",
[Html]
<InkCanvas x: Name = "icv" Margin = "1">
<Image Source = "6.jpg"
InkCanvas. Top = "10" InkCanvas. Left = "10"
Height = "200" type = "parmname" text = "parmname"/>
</InkCanvas>
Set UseCustomCursor to true to customize the shape of the mouse cursor.
[Html]
<InkCanvas x: Name = "icv" Margin = "1"
UseCustomCursor = "True"
Cursor = "Pen"/>
Set the defadradrawingattributes attribute to change the appearance of ink or pen. The following Code sets the pen width and height to 12, the pen header to a rectangle, and the color to orange.
[Csharp]
DrawingAttributes drwAttr = new DrawingAttributes ();
DrwAttr. Color = Colors. Orange;
DrwAttr. Height = 12;
DrwAttr. Width = 12;
// The pen header is square
DrwAttr. StylusTip = StylusTip. Rectangle;
This. icv. DefaultDrawingAttributes = drwAttr;
From the column tcjiaan