System.Drawing.Size unit

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

what is the unit of System.Drawing.Size?

when i'm writing Size = (1024,784), is it pixel? or something else?

Thanks,
 
its dont have any specific unit .its only take the value height and width in
int.
 
Gidi said:
what is the unit of System.Drawing.Size?

when i'm writing Size = (1024,784), is it pixel? or something else?

It depends on the context. For Control properties (Size, Bounds,
ClientRectangle, etc), it's pixels. But for drawing, when the Size is
passed to something operating on a Graphics object, the Size is
interpreted according to the PageUnit property of that Graphics object.
So it could be any of the units found in the GraphicsUnit enumeration
except World, in that case.

Note of course also that a Graphics can have a transformation applied to
it, so any drawing using a Size is also affected by that. If the
PageUnit is Pixels, but you've got a 50% scaling factor applied, then
any Size you pass to a Graphics object winds up being in half-pixels
rather than whole pixels.

All the above is true for the Point struct too.

Pete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top