Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between System.Drawing.Point and System.Windows.Point?

Tags:

wpf

2d

  1. What's the difference between System.Drawing.Point and the System.Windows.Point?
  2. In what context should which one be used?

I'm working with WPF.

like image 837
Lernkurve Avatar asked Apr 17 '10 18:04

Lernkurve


People also ask

What is System drawing point?

PointF Struct (System.Drawing)Represents an ordered pair of floating-point x- and y-coordinates that defines a point in a two-dimensional plane.

What is Point class in C#?

The Point structure is a part of the System. Drawing namespace. You can either reference this namespace or create your own Point structure, which, if you only need it as a coordinate container could be a very simple structure. Something like: public struct Point { public int X {get;set;} public int Y {get;set;} }


2 Answers

System.Drawing.Point represents a GDI point and is used in Windows Forms. It can only hold integer values.

WPF doesn't use GDI anymore, so it has its own System.Windows.Point type to represents a point, which can have non integer values.

like image 195
Thomas Levesque Avatar answered Sep 21 '22 06:09

Thomas Levesque


One is used with the classes in System.Drawing namespaces, and one is used with WPF.

The System.Drawing.Point is not so surprisingly used with the classes in the System.Drawing namespaces. The System.Windows.Point is used with WPF.

like image 32
Guffa Avatar answered Sep 23 '22 06:09

Guffa