Image Rotation in C#
-
Dear Sir/Madam, I'am trying to rotate an image in a picture box control in C#.Along with that i'am drawing a rectangle on to the image for highlighting certain parts of the image.While rotating the image is getting rotated properly but the drawing which i have made on the image is not getting rotated.I have tried with rotate and rotateat methods but they just rotate the drawing but not with respect to the image. My requirement is that while i'am rotating the image, the drawn rectangle highlighting certain parts also should get rotated and highlight the very same area in the rotated form. Kindly help me, Regards, mmx
-
Dear Sir/Madam, I'am trying to rotate an image in a picture box control in C#.Along with that i'am drawing a rectangle on to the image for highlighting certain parts of the image.While rotating the image is getting rotated properly but the drawing which i have made on the image is not getting rotated.I have tried with rotate and rotateat methods but they just rotate the drawing but not with respect to the image. My requirement is that while i'am rotating the image, the drawn rectangle highlighting certain parts also should get rotated and highlight the very same area in the rotated form. Kindly help me, Regards, mmx
Have you created a Graphics object from the image? This will effectively draw on the image, so any post-processing should also apply to the drawings.
-
Have you created a Graphics object from the image? This will effectively draw on the image, so any post-processing should also apply to the drawings.
Drawing on the image is not the issue...That is done using the graphics object only...But while the image is rotated the drawings position is not changed or rotated.It lies in the same place...while image is rotated... Also while creating graphics from image an exception is popping 'coz it is saying "creating graphics object from image that has indexed pixel format is not possible " I need some mapping modes equivalent to MM_HIENGLISH,MM_HIMETRIC in VC++ in C#.NET...Also help me a bit with code... Kindly help me out Barry... Regards, MMX
-
Dear Sir/Madam, I'am trying to rotate an image in a picture box control in C#.Along with that i'am drawing a rectangle on to the image for highlighting certain parts of the image.While rotating the image is getting rotated properly but the drawing which i have made on the image is not getting rotated.I have tried with rotate and rotateat methods but they just rotate the drawing but not with respect to the image. My requirement is that while i'am rotating the image, the drawn rectangle highlighting certain parts also should get rotated and highlight the very same area in the rotated form. Kindly help me, Regards, mmx
A quick search for "image rotation" on CodeProject turns up several articles, including a pretty good one, Image Rotation in .NET[^].
Microsoft MVP, Visual C# My Articles