Gragphics.DrawImage on a flipped Image

Tech-Archive recommends: Fix windows errors by optimizing your registry



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. .



Relevant Pages

  • how to kill the frame?
    ... public class draw { ... public static void main{ ... frame no respond,how to send a "close message" to the frame? ...
    (comp.lang.java.programmer)
  • FIFA Organising Committee approves Final Draw procedure and pots.
    ... Final Draw of the 2010 FIFA World Cup South Africa™, ... seven squads that join hosts South Africa as seeded teams for the ... Pot 2 will be composed of teams from Asia (Australia, Japan, Korea ... seeded teams will be drawn into the other groups B-H, ...
    (rec.sport.soccer)
  • Re: Sat Sels
    ... decent enough sort to aim at this,again the draw may be the most influential ... back to 7f is hardly ideal but with a bit of juice in the ground I ... BEAVER PATROL - drawn 16, Another last time out winner who looks a bit ... This is my dark horse. ...
    (uk.sport.horseracing)
  • Re: why do other usually write like this?
    ... I don't think this use of "draw" is common anymore in BrE. ... 1730-6 BAILEY s.v., To draw as tea. ... Physic 83 Oil of sweet Almonds newly drawn. ...
    (alt.usage.english)
  • Re: Just Suppose....
    ... to draw up a ranked list of ball numbers in order of presumed ... likeliness of being drawn. ... i toss it 3 zahl times. ...
    (rec.gambling.lottery)