G
Guest
Hi
Via an adapted Paint-method I try to zoom in on a part of a bitmap (8 x 8
pixels). So I defined the source rectangle of the image and the destination
rectangle on my application form (see code). That works well, but the pixels
of the first row and the first column are only rendered for half the size.
Can anyone explain that ...?
Thx
Frans
protected override void OnPaint(PaintEventArgs e)
{
// destination rectangle
Rectangle rectDst = new Rectangle();
rectDst.X = 0;
rectDst.Y = 0;
rectDst.Width = 320;
rectDst.Height = 320;
// source rectangle
Rectangle rectSrc = new Rectangle();
rectSrc.X = 0;
rectSrc.Y = 0;
rectSrc.Width = 8;
rectSrc.Height = 8;
// draw (part of the image)
Graphics g = e.Graphics;
g.InterpolationMode = InterpolationMode.NearestNeighbor ;
g.DrawImage( Bm, rectDst, rectSrc, GraphicsUnit.Pixel );
}
Via an adapted Paint-method I try to zoom in on a part of a bitmap (8 x 8
pixels). So I defined the source rectangle of the image and the destination
rectangle on my application form (see code). That works well, but the pixels
of the first row and the first column are only rendered for half the size.
Can anyone explain that ...?
Thx
Frans
protected override void OnPaint(PaintEventArgs e)
{
// destination rectangle
Rectangle rectDst = new Rectangle();
rectDst.X = 0;
rectDst.Y = 0;
rectDst.Width = 320;
rectDst.Height = 320;
// source rectangle
Rectangle rectSrc = new Rectangle();
rectSrc.X = 0;
rectSrc.Y = 0;
rectSrc.Width = 8;
rectSrc.Height = 8;
// draw (part of the image)
Graphics g = e.Graphics;
g.InterpolationMode = InterpolationMode.NearestNeighbor ;
g.DrawImage( Bm, rectDst, rectSrc, GraphicsUnit.Pixel );
}