Current filter:
                                You should refresh the page.
                                  • Hello,

                                    I've been using the CustomCardCaptionImage event for layoutview for awhile now, but as of this version, I'm getting an exception after it draws the last card's caption image. I've removed the event method after and it works as expected (minus the image).

                                    Here is the code for the event and the exception after:

                                    private void layoutView1_CustomCardCaptionImage(object sender, DevExpress.XtraGrid.Views.Layout.Events.LayoutViewCardCaptionImageEventArgs e) { LayoutView view = sender as LayoutView; int idx = view.GetDataSourceRowIndex(e.RowHandle); if (idx < 0 && idx < ques.Count()) return; RegularQuestion q = ques[idx]; Bitmap bmp = null; if (q.inputtype.ToUpper() == "YESNO") { if (ques[idx].fields.@default == "Y") bmp = new Bitmap(Properties.Resources._checked); if (ques[idx].fields.@default == "N" || string.IsNullOrEmpty(ques[idx].fields.@default)) bmp = new Bitmap(Properties.Resources._unchecked); } else bmp = new Bitmap(Properties.Resources.CaptionHeight); e.Image = bmp; }

                                    C# Unhandled exception:System.NullReferenceException: Object reference not set to an instance of an object. at DevExpress.Utils.SafeForcedImageOptionsDpiChange..ctor(ImageOptions imageOptions, Nullable`1 forcedScaleFactor) at DevExpress.Utils.Drawing.GroupCaptionImagePainter.DrawObject(ObjectInfoArgs e) at DevExpress.Utils.Drawing.ObjectPainter.DrawObject(GraphicsCache cache, ObjectPainter painter, ObjectInfoArgs e) at DevExpress.Utils.Drawing.RotateObjectPaintHelper.DrawRotated(GraphicsCache cache, ObjectInfoArgs info, ObjectPainter painter, RotateFlipType rotate, Boolean alwaysCreate) at DevExpress.Utils.Drawing.GroupObjectPainter.DrawCaptionImage(GroupObjectInfoArgs info) at DevExpress.Utils.Drawing.GroupObjectPainter.<DrawObject>b__40_1(GroupCaptionCustomDrawEventArgs drawArgs) at DevExpress.XtraEditors.GroupCaptionCustomDrawEventArgs.DefaultDraw() at DevExpress.Utils.Drawing.GroupObjectPainter.RaiseCustomDrawCaption(GroupObjectInfoArgs info, Action`1 defaultDraw, Action`1 defaultDrawBackground, Action`1 defaultDrawText, Action`1 defaultDrawButtons, Action`1 defaultDrawImage) at DevExpress.Utils.Drawing.GroupObjectPainter.DrawObject(ObjectInfoArgs e) at DevExpress.XtraGrid.Views.Layout.Drawing.LayoutViewSkinCardObjectPainter.DrawObject(ObjectInfoArgs e) at DevExpress.Utils.Drawing.ObjectPainter.DrawObject(GraphicsCache cache, ObjectPainter painter, ObjectInfoArgs e) at DevExpress.XtraLayout.Painting.LayoutGroupPainter.DrawBackground(BaseLayoutItemViewInfo e) at DevExpress.XtraGrid.Views.Layout.Drawing.LayoutViewCardSkinPainter.DrawBackground(BaseLayoutItemViewInfo e) at DevExpress.XtraLayout.Painting.BaseLayoutItemPainter.DrawObjectCore(BaseLayoutItemViewInfo vi) at DevExpress.XtraLayout.Painting.LayoutGroupPainter.<>c__DisplayClass5_0.<DrawObject>b__0() at DevExpress.XtraLayout.ItemCustomDrawEventArgs.DefaultDraw() at DevExpress.XtraLayout.Painting.LayoutGroupPainter.DrawObject(ObjectInfoArgs e) at DevExpress.Utils.Drawing.ObjectPainter.DrawObject(GraphicsCache cache, ObjectPainter painter, ObjectInfoArgs e) at DevExpress.XtraGrid.Views.Layout.Drawing.LayoutViewPainter.DrawCardCore(GraphicsCache cache, LayoutViewCard card) at DevExpress.XtraGrid.Views.Layout.Drawing.LayoutViewPainter.DrawCard(LayoutViewDrawArgs e, LayoutViewCard card) at DevExpress.XtraGrid.Views.Layout.Drawing.LayoutViewPainter.Draw(ViewDrawArgs ee) at DevExpress.XtraGrid.Views.Base.BaseView.Draw(GraphicsCache e) at DevExpress.XtraGrid.GridControl.OnPaintCore(PaintEventArgs e) at DevExpress.XtraGrid.GridControl.OnPaint(PaintEventArgs e) at DevExpress.Utils.Drawing.ControlPaintHelper.PaintWithErrorHandling(PaintEventArgs paintEventArgs, Int32 layer) at DevExpress.Utils.Drawing.ControlPaintHelper.ProcessWMPaintCore(Boolean beginPaint, IntPtr hdc, Rectangle rectangle, Rectangle[] clipBounds) at DevExpress.Utils.Drawing.ControlPaintHelper.ProcessWMPaint(Message& m) at DevExpress.XtraGrid.GridControl.CheckProcessMsg(Message& m) at DevExpress.XtraGrid.GridControl.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

                                • Nadezhda (DevExpress Support) 11.07.2019


                                  I have reproduced the issue and forwarded this thread to our developers. We will update this thread when we make any progress.

                                  By the way, creating a new bitmap in the CustomCardCaptionImage event handler is not resource effective. Instead, I recommend you cache the required bitmaps in a separate collection and only assign them in this event handler.

                                • trent torkelson 11.08.2019

                                  Awesome and good point. I'll give that a try!


                                • trent torkelson 11.08.2019

                                  It seems that even when setting these images up statically prior to the use of them, we're still seeing the issue. We'll wait for the hotfix.

                                1 Solution

                                Creation Date Importance Sort by


                                • 19.2.4 : Official update is coming
                                • Maurice Dallau 11.08.2019

                                  We're experiencing the same error, is it possible to send us the hotfix too?

                                • Igor (DevExpress Support) 11.08.2019

                                  The hotfix requested. We usually deliver a hotfix within a week after it has been requested. We will send you an automatic notification as soon as it is ready for download, Maurice.

                                • Konstantinos Chionas 11.19.2019

                                  Have same problem, waiting for the fix.

                                • Nadezhda (DevExpress Support) 11.20.2019

                                  Hello Konstantinos,

                                  We are finishing testing the new minor version and are going to release it soon. So, the hotfix for this version is currently unavailable.

                                  If everything goes according to plan, this version will be available to you during this week. As always, we will notify all registered license holders via email.