【问题标题】:Windows form throws Argument exception when the control size is larger in design modeWindows 窗体在设计模式下控件大小较大时引发 Argument 异常
【发布时间】:2011-10-14 06:49:22
【问题描述】:

我在 Windows 窗体上有第三方控件,第三方控件(控件大小(829px,1169px))是根据测量单位像素呈现的。我已将其测量单位更改为厘米,以便以厘米为单位呈现控件。更改测量单位后,我通过鼠标移动控件以将其放置在所需位置,同时移动控件,方法位图(宽度 = 34000 厘米,高度 = 45000 厘米)抛出“参数异常未处理”异常。仅当表单具有默认大小时才会引发此异常。 我已将表单的大小更改为最大大小,然后我再次移动控件,现在控件毫无例外地被移动,但速度有点慢。我不知道为什么当表单为默认大小时会引发此异常?

.net 是否根据表单大小呈现控件?

这是否是网络问题? 注意:控制在运行时完美运行,同时更改测量单位.....

谁能帮我解决这个问题??????

我已经用这个问题发布了我的堆栈跟踪。

在此先感谢......

堆栈跟踪:

System.ArgumentException was unhandled

Message="参数无效。" 来源="系统.绘图" 堆栈跟踪: 在 System.Drawing.Bitmap..ctor(Int32 宽度,Int32 高度,PixelFormat 格式) 在 C:\Users\amsathm\Desktop\Source\Trunk\Base\Entities\LayoutGrid.cs:line 495 中的 Syncfusion.Windows.Forms.Diagram.LayoutGrid.Draw(Graphics grfx, RectangleF rectGrid) 在 Syncfusion.Windows.Forms.Diagram.View.Draw(Graphics grfx, RectangleF rectClip) 在 C:\Users\amsathm\Desktop\Source\Trunk\Base\MVC\View.cs:line 1891 在 C:\Users\amsathm\Desktop\Source\Trunk\Windows\Controls\Diagram.cs: 4152 中的 Syncfusion.Windows.Forms.Diagram.Controls.Diagram.OnPaint(PaintEventArgs e) 在 Syncfusion.Windows.Forms.ScrollControl.OnEnsurePaintCodeJitted() 在 Syncfusion.Windows.Forms.ScrollControl.EnsurePaintCodeJitted(布尔忽略可见) 在 Syncfusion.Windows.Forms.ScrollControl.OnHandleCreated (EventArgs e) 在 System.Windows.Forms.Control.WmCreate(消息和 m) 在 System.Windows.Forms.Control.WndProc(消息和 m) 在 Syncfusion.Windows.Forms.ScrollControl.WndProc(消息和消息) 在 C:\Users\amsathm\Desktop\Source\Trunk\Windows\Controls\Diagram.cs: 4836 中的 Syncfusion.Windows.Forms.Diagram.Controls.Diagram.WndProc(Message& m) 在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(消息和 m) 在 System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

enter code here

【问题讨论】:

    标签: c# windows winforms


    【解决方案1】:

    Bitmap 构造函数可能会在指定名称不以 Format 开头的 PixelFormat 值时抛出 ArgumentException。请验证传递的是什么值,使用以Formatxxx 开头的格式。

    【讨论】:

    • 但是当表格尺寸最大时它会毫无例外地移动。
    • 只有在设计模式下移动控件时才会出现此异常。在运行时它可以完美运行...
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-04-30
    • 1970-01-01
    • 1970-01-01
    • 2012-05-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多