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 WPF ApplicationProgramAdd the following XAML to the grid:
<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 ",
<Inkcanvas X: Name = "icv" margin = "1"> <Image Source = "6.jpg" inkcanvas. top = "10" inkcanvas. left = "10" Height = "200"/> </inkcanvas>
Set usecustomcursor to true to customize the shape of the mouse cursor.
<Inkcanvas X: Name = "icv" margin = "1" usecustomcursor = "true" cursor = "pen"/>
Set the defadradrawingattributes attribute to change the appearance of ink marks or pen headers, as shown in the followingCodeSet the width and height of the pen to 12, the pen to a rectangle, and the color to orange.
Drawingattributes drwattr = new drawingattributes (); drwattr. color = colors. orange; drwattr. height = 12; drwattr. width = 12; // The pen header is a square drwattr. stylustip = stylustip. rectangle; this. icv. defaultdrawingattributes = drwattr;