Monday, November 7, 2011

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

Q.) I want to draw a line using controlpaint.DrawReversibleLine method and tried to pass system.windows.point, but it wants system.drawing.point input. I am little confused. What are the differences between them? Or How are they different besides the noticeable differences?
Thanks,

A.) System.Windows.Point is a WPF structure, whereas System.Drawing.Point is a WinForms structure. In general, if you're writing a WinForms app, the don't use stuff from any of the System.Windows namespaces (except System.Windows.Forms). The resources in these namespaces are WPF specific, so unless you intend to interface WPF and WinForms, it would be best to avoid them.

Other answers:
  • System.Windows.Point is intended for WPF applications.
    The System.Windows namespaces contain types used in Windows Presentation Foundation (WPF) applications, including animation clients, user interface controls, data binding, and type conversion
  • System.Drawing.Point is intended for WinForms applications.
    The System.Drawing namespace provides access to GDI+ basic graphics functionality.


No comments: