Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
130
UltraWinGrid "Blacks Out" On Refresh When Using Classic Theme
posted

We're using the UltraWinGrid version 7.1 (version number: 7.1.20071.40) on our winforms application. When the machine has classic themes enabled the grid "blacks out" when rebinding to a data source. I've tried fiddling with backcolor, inactivecolor and various other display properties in an attempt to leave the background white, however to no avail.

Is there some property that i'm missing which will address this? We already call begin and end update to stop painting whilst we rebind but removing that has no effect and it doesnt explain why it blacks out on classic themes and not WinXP themes.

The Application is running on Windows XP SP2.

Parents
No Data
Reply
  • 37774
    Verified Answer
    posted

    The BeginUpdate and EndUpdate calls prevent the grid from painting anything when a paint request is received, so the graphics buffer will remain uninitialized and appear as black in the area that is not being painted.  I'm not entirely sure why this only happens in Classic mode, but I recall seeing an issue a while ago that additional paint messages were sent to the grid in this case, so it's possible that the OS caches some information when not using Classic.

    One workaround that you could try is to derive your own grid and override the OnPaint method, setting a flag yourself to know if you're currently updating/rebinding.  If so, you can paint a white rectangle yourself, otherwise call the base implementation:


    protected override void OnPaint(PaintEventArgs e)
    {
        if(updating)
            e.Graphics.FillRectangle(Brushes.White, e.ClipRectangle);
        else
            base.OnPaint(e);
    }

    -Matt

Children