Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between System.Windows.Size and System.Drawing.Size? [duplicate]

Tags:

c#

.net

size

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

Why are there these two different Size structures? Under what circumstances would you choose to use each of these? I am unclear about how to choose the correct one in my code.

like image 287
JNygren Avatar asked Jan 27 '26 03:01

JNygren


1 Answers

System.Drawing.Size is part of GDI+.
System.Windows.Size is part of WPF.

The most noticable difference is that System.Drawing.Size uses ints for its width and height fields, while the System.Windows.Size uses doubles.

This stems from the fact that the WPF layout framework is vector based and not raster based like GDI+.

You choose one or the other depending on the UI framework you are using.

like image 80
Rotem Avatar answered Jan 28 '26 17:01

Rotem