adding an icon image for a button

3 posts, 1 answers
  1. David T.
    David T. avatar
    4 posts
    Member since:
    Aug 2007

    Posted 17 Jun 2013 Link to this post

    I am aware that you can add an icon image through the property -> images -> and import an image from there.  I was trying to find a way to hard code this because for one button, i want to alternate between 2 different images.  I was wondering if you could provide a link or example code of how i can do that, or how to hard code an icon image into a command bar button.
  2. Answer
    George avatar
    500 posts

    Posted 18 Jun 2013 Link to this post

    Hello David,

    Thank you for contacting us.

    To change a button's image with code you need to change its Image property. See the example belowIf you want to cut the size of the picture to 100x100px:
    this.commandBarButton1.Image = Image.FromFile("button-pic.jpg").GetThumbnailImage(100, 100, null, IntPtr.Zero);

    If you want to keep the picture's original size:
    this.commandBarButton1.Image = Image.FromFile("button-pic.jpg");

    For any further questions do not hesitate to contact us.

    RadChart for WinForms is obsolete. Now what?

    this.commandBarButton1.Image = Image.FromFile("button-pic.jpg")
  3. Fran
    Fran avatar
    1 posts
    Member since:
    Mar 2017

    Posted 17 Mar 2017 in reply to George Link to this post

Back to Top