I have a panel control and a bitmap with the same size. When I resize the panel I want the bitmap to be drawn on it. I use DrawImage(Image, Int32, Int32, Int32, Int32)
This is the panel (Canvas) Paint Event
private void Canvas_Paint(object sender, PaintEventArgs e)
{
e.Graphics.DrawImage(image, 0, 0, Canvas.Width, Canvas.Height);
}
But the image moves a bit. Looks like the method draws it in (-0.5, -0.5) instead of (0, 0)
Bitmap on panel (Red pixel is cut and dark grey border appears)
How to fix it?