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