1
我使用PictureEdit
(DevExpress控件)作为某种形式的子项。我试图使用MouseEventArgs
坐标属性将一个像素绘制到加载的图像上。发生无法在位图上绘制
private void PictureEditorOnMouseMove(Object sender, MouseEventArgs e)
{
if(e.Button == MouseButtons.Left)
{
(this.pictureEditor.Image as Bitmap).SetPixel(e.X, e.Y, this.colorPicker.Color);
}
}
ArgumentOutOfRangeException说,传递给SetPixel方法x
(或y
)参数不积极小于给定的位图的Height
财产更大& &。 我在考虑使用由bitmap.Width
和bitmap.Height
绑定的坐标。
我该如何绑定它们?或者我做错了什么?
谢谢!
当你调试时,e.X和e.Y有什么值?他们在位图的范围内? – LueTm 2011-05-24 06:58:09
你为什么要测试鼠标移动按钮? – 2011-05-24 07:05:58
@David不应该吗? – lexeme 2011-05-24 07:19:08