Ticket Q106588
Visible to All Users

How to properly change the ribbons application button glyph image at runtime?

created 17 years ago

Hi
I need to change the glyph image of the ribbons application button approximately once every seond.
I use the following code to draw a 24x24 PNG image to the glyph, from a TcxImageList:
      ribbon.applicationButton.glyph.canvas.brush.color := clNone;
      ribbon.applicationButton.glyph.canvas.FillRect( rect(0, 0, 24, 24) );
      ilPNG.Draw(ribbon.applicationButton.glyph.canvas, 0, 0, random(il24x24.count), dsNormal, itImage);
The problem is that the glyph flickers, due to the .FillRect call, which is needed to clear the previously drawn glyph.
I've tried to put 'canvas.lock' / 'canvas.unlock' around the above code, but it still flickers.
Anyone know how that can be solved?

Show previous comments (6)
DevExpress Support Team 17 years ago

    Hi Simon,
    Thank you for the response.
    However, surrounding this code with BeginUpdate/EndUpdate method calls seems to fix the problem at our side. Attached is a small sample project that seems to work fine at our end. Please try it, and let us know how it goes.
    Thanks,
    Vito

      Hi Vito,
      Yep, the attached project works without flickering, but it uses the "assign" method to set the glyph, which causes the alpha transparent part of the glyph to be drawn incorrectly. (see earlier post in thread)

      DevExpress Support Team 17 years ago

        Hi Simon,
        It appears that I attached an old project version to my previous post. Please accept my apologies for this mistake.
        Attached is the correct version of this sample project. Please try it, and let us know your results.
        Thanks,
        Vito

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.