Gragphics.DrawImage on a flipped Image
- From: Steven <"[ILMIONICK]3000"@virgilio.it>
- Date: Mon, 29 Aug 2005 10:04:47 GMT
I need to draw to an image after it has been rotated, but if I draw something before the rotation is done then DrawImage doesn't work:
Here's the code.
using System; using System.Drawing;
class ImageTest
{
public static void Main()
{
Image img = new Bitmap(67,98);
Graphics g = Graphics.FromImage(img); //Without this line it works
g.DrawLine(new Pen(Color.Black), 0, 0, 67, 98); //Width e Height are swapped
img.RotateFlip(RotateFlipType.Rotate90FlipNone); g = Graphics.FromImage(img);
Image img2 = new Bitmap("test.bmp"); //img.Width is 98
g.DrawImage(img2, 80, 0);
img.Save("result.bmp");
}
}The result of the code above is only a diagonal line. If the call to DrawLine is removed, test.bmp is drawn too.
Please help. .
- Prev by Date: Interop Marshalling Overhead - Newbie qn
- Next by Date: How to get list of shared folders
- Previous by thread: Interop Marshalling Overhead - Newbie qn
- Next by thread: How to get list of shared folders
- Index(es):
Relevant Pages
|