How to add images in a radbutton in winforms?

3.9k views Asked by At

I am currently using vb.net in Visual Studio 2010 and am using radbuttons for winforms.

How can I have a button which has an image on the left part and a text on the right? I can't find the right property to set the image.

Yes, i can set the property of Displaystyle (image and text) and the imagealignment (middleleft)

anyone who can share his knowledge?

thanks!

2

There are 2 answers

0
Olivier Jacot-Descombes On

Set Appearance to Appearance.Button

Set the Image property

Set TextImageRelation to TextImageRelation.ImageBeforeText

The default appearance Appearance.Norm shows the traditional radio button with the image in the label part.

0
Robin Rizvi On

If your question is a about a normal button then you can change the image property of the button from the properties window in Visual Studio.

If you are generation the button dynamically you can:

yourbuttonobject.Image = Image.FromFile(@"path to your image");
this.Controls.Add(yourbuttonobject);//controls have to be added to a container control

If your question is about the telerik radbutton control from Telerik Telerik Rad Buttons for WinForms then you can theme the button like this How to theme the Telerik radbutton button

If your question is about a radiobutton you theme it from the properties window or through code like this:

private void Form1_Load(object sender, EventArgs e)
        {
            RadioButton dynamicRadioButton = new RadioButton();
            dynamicRadioButton.Text = "I am a Dynamic RadioButton";
            dynamicRadioButton.Location = new Point(20, 20);
            dynamicRadioButton.Height = 40;
            dynamicRadioButton.Width = 300;
            dynamicRadioButton.Name = "DynamicRadioButton";
            dynamicRadioButton.Image = Image.FromFile(@"your_image_path");
            this.Controls.Add(dynamicRadioButton);
        }