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
210
Which appearance should I change?
posted

I've heavily customised the colours of my WinGrid including the colour of the scrollbars, but there's a grey rectangle that appears in the bottom-right corner of the grid when both scrollbars are visible.  Which appearance do I need to change/override in order to make that rectangle blue?

Here's a screenshot... I've drawn a red X in the rectangle whose colour I wish to change.

 

Thanks

Andy

Parents
  • 469350
    Verified Answer
    Offline posted

    Hi Andy,

    What you are looking at here is the ScrollbarIntersectionUIElement. There aren't any Appearance properties that affect this area, but you can set it's color in a number of ways.

    One way to do this is via Application Styling. But it would be a lot of work to use AppStyling just to style one tiny little element like this.

    Another option would be to use a DrawFilter. This is much easier. Here's some sample code.


        public class MyDrawFilter : IUIElementDrawFilter
        {

            #region IUIElementDrawFilter Members

            bool IUIElementDrawFilter.DrawElement(DrawPhase drawPhase, ref UIElementDrawParams drawParams)
            {
                if (drawParams.Element is ScrollbarIntersectionUIElement)
                {
                    switch (drawPhase)
                    {
                        case DrawPhase.BeforeDrawBackColor:
                            drawParams.AppearanceData.BackColor = Color.Blue;
                            break;
                    }
                }

                return false;
            }

            DrawPhase IUIElementDrawFilter.GetPhasesToFilter(ref UIElementDrawParams drawParams)
            {
                if (drawParams.Element is ScrollbarIntersectionUIElement)
                    return DrawPhase.BeforeDrawBackColor;

                return DrawPhase.None;
            }

            #endregion
        }

     

    You assign the DrawFilter to the grid like this:

    this.ultraGrid1.DrawFilter = new MyDrawFilter();

    You can do this in the form constructor or in the Form_Load.

Reply Children
No Data