using (var thumbnailBitmap = new Bitmap(newWidth, newHeight, PixelFormat.Format32bppArgb))
using (var thumbnailGraph = Graphics.FromImage(thumbnailBitmap))
{
thumbnailGraph.DrawImage(image,
new Rectangle(destX, destY, destWidth, destHeight),
new Rectangle(sourceX, sourceY, sourceWidth, sourceHeight),
GraphicsUnit.Pixel);
}
}
And I get a 400X300 rectangle. the actual parameters are :
thumbnailGraph.DrawImage(image,
new Rectangle(11, 0, 377, 300),
new Rectangle(0, 0, 800, 635),
GraphicsUnit.Pixel);
if the point is 11,0 and the width is 377, how do I get an image of 400X300? I am so curious about this...
If anyone knows, or can point me at the right direction, I will be grateful.
Member
14 Points
70 Posts
System Drawing Rectangle - How does this happen?
Sep 12, 2011 06:31 AM|yonatan1082|LINK
I am using the following code :
using (var thumbnailBitmap = new Bitmap(newWidth, newHeight, PixelFormat.Format32bppArgb))
using (var thumbnailGraph = Graphics.FromImage(thumbnailBitmap))
{
thumbnailGraph.DrawImage(image,
new Rectangle(destX, destY, destWidth, destHeight),
new Rectangle(sourceX, sourceY, sourceWidth, sourceHeight),
GraphicsUnit.Pixel);
}
}
And I get a 400X300 rectangle. the actual parameters are :
thumbnailGraph.DrawImage(image,
new Rectangle(11, 0, 377, 300),
new Rectangle(0, 0, 800, 635),
GraphicsUnit.Pixel);
if the point is 11,0 and the width is 377, how do I get an image of 400X300? I am so curious about this...
If anyone knows, or can point me at the right direction, I will be grateful.
Participant
1091 Points
354 Posts
Re: System Drawing Rectangle - How does this happen?
Sep 12, 2011 07:18 AM|sathish_juk|LINK
http://msdn.microsoft.com/en-us/library/system.drawing.rectangle.aspx
http://msdn.microsoft.com/en-us/library/aa287521(VS.71).aspx
http://support.microsoft.com/kb/314945
Sathish Kumar
Mark this post as "ANSWER", if it helped you..
Contributor
2923 Points
1417 Posts
Re: System Drawing Rectangle - How does this happen?
Sep 12, 2011 07:30 AM|navneetmitawa|LINK
hi try this
http://forums.asp.net/t/1227154.aspx/1
http://www.mikesdotnetting.com/Article/88/iTextSharp-Drawing-shapes-and-Graphics
Navneet Kumar Mitawa