I have the following code for a gallery control inside a user control that is used in an XAF Property editor.
I am using a MessageBox to troubleshoot why the OnPaint method sometimes fails. However the MessageBox itself displays a blank message when it is located near the bottom of the screen.
using DevExpress.XtraBars.Ribbon;
using DevExpress.XtraBars.Ribbon.Gallery;
using System;
using System.Windows.Forms;
namespace MyApp.Module.Win.Features.Jama.Editors.ThinWorkflow
{
public class MyGalleryControl : GalleryControl
{
protected override GalleryControlGallery CreateGallery() { return new myGallery(this); }
protected override void OnPaint(PaintEventArgs args)
{
try
{
base.OnPaint(args);
} catch(Exception ex)
{
MessageBox.Show($"In OnPaint:inner {ex.InnerException} :full:{ex.Message}", "MyGalleryControl:OnPaint");
// throw new Exception("In OnPaint");
}
}
}
}

I think it happens when the text is long enough to cause a line wrap off the screen.