Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Buttons, RadioButton, CheckBox, etc > How to use Transparent PNG as image for buttons?

Not answered How to use Transparent PNG as image for buttons?

Feed from this thread
  • Afraz Ali avatar

    Posted on Sep 8, 2010 (permalink)

    Hi,

    I have a PNG image (round button) and I want to use that as button. I have tried setting the image property to that image in radButton control but it shows the transparent area as well. My Question is how can I use round images as buttons and is the procedure for using transparent images same for all controls?

    Thanks
    Afraz Ali

    Reply

  • Vassil Petev Vassil Petev admin's avatar

    Posted on Sep 9, 2010 (permalink)

    Hello Afraz Ali,

    Our image handling mechanism is the same as the standard WinForms controls. Try adding a transparent image to the standard button and use the same logic in the Telerik WinForms button.


    Greetings,
    Vassil
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

    Reply

  • Afraz Ali avatar

    Posted on Sep 15, 2010 (permalink)

    Hi Vassil ,

    Could you please tell me a step by step mechanism for this?

    Regards,
    Syed Afraz Ali

    Reply

  • Stefan Stefan admin's avatar

    Posted on Sep 20, 2010 (permalink)

    Hi Afraz Ali,

    Although this question is not related to our tools, we will address it any way, just to help you out.

    As noted, the steps to set an image in our tools is the same as setting an image in the standard MS controls. If you see the transparent area, then either your image is not transparent, or you have not set its background color to be transparent. The latter can be done through an ImageList:
    1. Add an ImageList component to your form
    2. Load the images into an imagelist.
    3. Go to the ImageLlist's properties and change the TransparentColor property to the background color that you would like to be transparent.
    4. Set ColorDepth to your png's color depth, usually Depth8Bit
    5. Assign the ImageList to the button via the button's ImageList property
    6. Go to the button's ImageKey property and select the image you would like to display
    7. Run the application to see the result

    If you still experience problems, please review the Microsoft Developer Network (MSDN) on how to work with transparent images.


    Greetings,
    Stefan
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

    Reply

  • Posted on Jul 13, 2011 (permalink)

    as a 'sold' product, it would be a great benefit if the RadButton had off-the-shelf feature to make it look like an image button w/o much settings.

    I am also trying to set an image on the regular button and rad button - so that I can see just the image - but both of them show some background control color and not able to make it transparent. I set the control's BackColor property as well - but no luck.

    Reply

  • Stefan Stefan admin's avatar

    Posted on Jul 15, 2011 (permalink)

    Hello Piyush,

    Thank you for writing.

    You can set an image to RadButton and display only the image with two lines of code:
    button.Image = Image.FromFile(@"C:\image.png");
    button.AutoSize = true;

    I hope this helps.
     
    Kind regards,
    Stefan
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Buttons, RadioButton, CheckBox, etc > How to use Transparent PNG as image for buttons?
Related resources for "How to use Transparent PNG as image for buttons?"

[ Features | Demos | Documentation | Knowledge Base | Telerik TV | Code Library | Step-by-step Tutorial | Blogs | Self-Paced Trainer ]