in a form application with a picture box fitting within the form with the following handler for the picture box's Paint:
void f9(Graphics g)
{
var img = new Bitmap(3, 2);
var memG = Graphics.FromImage(img);
memG.FillRectangle(new SolidBrush(Color.Black), 0, 0, img.Width, img.Height);
GlobalFunctions.PutPixel(memG, new Pen(Color.Red), 1, 0);
GlobalFunctions.PutPixel(memG, new Pen(Color.Blue), 0, 1);
GlobalFunctions.PutPixel(memG, new Pen(Color.GreenYellow), 2, 0);
GlobalFunctions.PutPixel(memG, new Pen(Color.Cyan), 2, 1);
var srcRect = new Rectangle(0, 0, img.Width, img.Height);
int factor = 100;
var destRect = new Rectangle(0, 0, img.Width * factor, img.Height * factor);
g.FillRectangle(new SolidBrush(Color.DarkCyan), pictureBox1.ClientRectangle);
g.DrawRectangle(new Pen(Color.Blue), destRect);
g.DrawImage(img, destRect, srcRect, GraphicsUnit.Pixel);
}
i get the following output:
why? i expect this to be the result of drawing an image which is 4x3 instead of 3x2 which its 3 right points and 4 bottom points be of color dark blue. got what i mean?
is there any description for this behavior of DrawImage?