backdoor
backdoor

Reputation: 133

question about working with System.Drawing.Graphics

i have a System.Drawing.Point[] filled with some System.Drawing.Point's. so when i want to draw this points as a polygon in a System.Windows.Form instance , the final drawn polygon is not all in the screen or sometimes is very small (in screen shown as 2-3 pixel). i wonder if there is some Library that using that i can just send Point[] to that and thatself scales and ... points and draws polygon manner that all points shown in screen and they are scaled to fit the screen (i mean small objects that shown as 2-3 pixel scale up to fit entire screen);

thaks all and sorry for my bad english...

Upvotes: 1

Views: 120

Answers (1)

Lucero
Lucero

Reputation: 60190

You can apply a Scale Transformation on the Graphics object before drawing your polygon.

For 10* enlargement, this would be this (assuming that graphics is an instance of Graphics):

graphics.ScaleTransform(10.0f, 10.0f);

If you want to scale to the screen, you first need to compute the maximum extent of the points (e.g. minimum and maximum of both X and Y) and use this information to compute the scaling factor.

Upvotes: 1

Related Questions