Continue to talk about WPF-digital ink

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.