c#system.drawing.drawimage()在错误的地方绘制位图
我有一个面板控件和大小相同的位图。调整面板大小时,我希望在其上绘制位图。我使用drawimage(Image,int32,int32,int32,int32)
这是面板(帆布)涂料事件
private void Canvas_Paint(object sender, PaintEventArgs e)
{
e.Graphics.DrawImage(image, 0, 0, Canvas.Width, Canvas.Height);
}
,但图像有点移动。看起来该方法将其绘制在(-0.5,-0.5)中,而不是(0,0)
上的位图(剪切了红色像素和深灰色边框)
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论