Ticket Q18021
Visible to All Users

ApplicationButton - Assign PNG-Images on runtime

created 18 years ago

Hello,
i have to assign images for toolbars and the ribbon Application Button on runtime from file.
I tried the following Code:
  dxRibbon.ApplicationButton.Glyph.LoadFromFile(Directory+'\shopexpress.png');
Then I get an error: Bitmap is not valid (Bitmap ist ungültig)
I hope you can help me to solve this problem.
Best Regards
Johannes Teitge

Comments (1)
Serge (DevExpress Support) 18 years ago

    Hi Johannes,
    You should convert a PNG file to a TBitmap before loading it to the Glyph property. This can be done by means of the TdxPNGImage class (dxGDIPlusClasses.pas):
     1) call its LoadFromFile method to load an image from PNG file;
     2) call its GetAsBitmap method to obtain a bitmap representation of the loaded PNG image.
    You can find more information about this approach in other reports posted here. For example, read report CB47400 ("Application Button - Incorrect alpha blending for 32 bit images").
    Thanks,
    Serge

    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.