Comparison and conversion between drawing. Point and windows. Point

Source: Internet
Author: User

1. system. Drawing. Point

It indicates the ordered pairs of point, integer x, and Y coordinates defined in the two-dimensional plane. X and Y are integers;. NET 2.0 is mainly used in Windows form to indicate a point of GDI +.

2. system. Windows. Point

X and Y coordinate pairs in two-dimensional space. X and Y are of the double type. Net 3.0, mainly used in WPF, while WPF does not use GDI +.

3. Comparison:

System. Windows. point can be converted to system. Drawing. Point, but it may cause loss of precision.

System. Drawing. Point can also be converted to system. Windows. Point without loss of precision.

The area of system. Windows. Point is larger than that of system. Drawing. Point, but the two are not comparable because they represent different objects.

We recommend that you override the equals Method for point comparison.

4. Conversion Method:

System. Windows. Point wpoint = new system. Windows. Point (1.1, 2.33434 );
System. Drawing. Point dpoint = new system. Drawing. Point (1, 2 );

Dpoint. x = (INT) wpoint. X;
Dpoint. Y = (INT) wpoint. Y;

// Wpoint. x = dpoint. X;
// Wpoint. Y = dpoint. Y;

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.