我有一个简单的应用程序,如“绘画”,我画了一个位图,设置为pictureBox.Image
。我可以在这里绘制多边形并将它们捕捉到顶点并移动,因此位图必须重绘。 有重绘方法。'System.ArgumentException'发生在System.Drawing.dll
private void DrawFullList()
{
if(pictureBox2.Image != null)
pictureBox2.Image.Dispose();
graphic = new Bitmap(pictureBox2.Width, pictureBox2.Height); // exception here
g = Graphics.FromImage(graphic);
pictureBox2.Image = graphic;
for (int i = 0; i < PointsList.Count; i++)
{
bool yellowframe = false;
if (i == dblclck)
yellowframe = true;
Draw(BrushList[i], PointsList[i], yellowframe);
}
}
所以,如果我抓住顶点和移动鼠标,功能DrawFullList()
在pictureBox_MouseMove(object sender, MouseEventArgs e)
功能激活。当我移动一个顶点几秒(例如,制作圆圈)时,会抛出异常'System.ArgumentException' occurred in System.Drawing.dll
。 任何提示在这里? :)
编辑: 有关异常的附加信息: parameter is invalid
是否有伴随它的特定消息? –
参数无效 – Blabla
无效值的值是多少?你打破例外吗?询问价值,看看它不喜欢什么。 –