c语言fillrectangle函数,c# – FillRectangle参数无效

在尝试使用FillRectangle函数绘制矩形时遇到了System.ArgumentException异常,错误信息为'Parameter is not valid.'。异常发生在frmMain.cs文件的drawCboxItem方法中,具体代码涉及DrawItem事件处理。问题可能与传递给Graphics.FillRectangle的参数有关,特别是 Brush 和 Rectangle 对象。检查并确认传入的绘图区域和画刷是否有效,以避免该异常。
摘要由CSDN通过智能技术生成

这是我得到的例外

System.ArgumentException was unhandled

HResult=-2147024809

Message=Parameter is not valid.

Source=System.Drawing

StackTrace:

at System.Drawing.Graphics.CheckErrorStatus(Int32 status)

at System.Drawing.Graphics.FillRectangle(Brush brush, Int32 x, Int32 y, Int32 width, Int32 height)

at System.Drawing.Graphics.FillRectangle(Brush brush, Rectangle rect)

at frmMain.drawCboxItem(Object sender, DrawItemEventArgs e) in frmMain.cs:line 465

at frmMain.cboxSectionCell_DrawItem(Object sender, DrawItemEventArgs e) in frmMain.cs:line 485

at System.Windows.Forms.ComboBox.OnDrawItem(DrawItemEventArgs e)

at System.Windows.Forms.ComboBox.WmReflectDrawItem(Message& m)

at System.Windows.Forms.ComboBox.WndProc(Message& m)

at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)

at System.Wi

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值