将 UserControl 添加到 DevExpress 的图片编辑控件后,我能够成功地将其放置在某个位置并保存更改。
重新打开应用程序后,当我用图像填充 PictureEdit 然后将 UserControl 添加到 pictureEdit 控件集合时,错误图像显示在 PictureEdit 中以及消息“对象引用未设置为对象实例”-> 空引用。
System.NullReferenceException: Object reference not set to an instance of an object.
at DevExpress.XtraEditors.PictureEditScrollers.SetScrollBarValues()
at DevExpress.XtraEditors.PictureEditScrollers.DisplayScrollBars()
at DevExpress.XtraEditors.PictureEditScrollers.TryDisplayScrollBars(Boolean force)
at DevExpress.XtraEditors.PictureEdit.UpdateViewInfo(Graphics g)
at DevExpress.XtraEditors.BaseControl.OnPaint(PaintEventArgs e)
at System.Windows.Forms.Control.PaintTransparentBackground(PaintEventArgs e, Rectangle rectangle, Region transparentRegion)
at System.Windows.Forms.Control.PaintTransparentBackground(PaintEventArgs e, Rectangle rectangle)
at System.Windows.Forms.Control.PaintBackground(PaintEventArgs e, Rectangle rectangle, Color backColor, Point scrollOffset)
at System.Windows.Forms.Control.PaintBackground(PaintEventArgs e, Rectangle rectangle)
at System.Windows.Forms.Control.OnPaintBackground(PaintEventArgs pevent)
at System.Windows.Forms.ScrollableControl.OnPaintBackground(PaintEventArgs e)
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
at System.Windows.Forms.Control.WmEraseBkgnd(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
但是,如果我没有将 UserControl 添加到控件集合中,则图像会完美显示,但是我会丢失对 PictureEdit 的用户控制。
有什么建议吗?