This is a migrated thread and some comments may be shown as answers.

Rad Button with 3 Images and 3 labels

3 Answers 198 Views
Buttons, RadioButton, CheckBox, etc
This is a migrated thread and some comments may be shown as answers.
BB
Top achievements
Rank 1
BB asked on 10 Mar 2011, 01:45 PM

I need a button with 3 images and 3 labels.

Thank you very much.

-----------------------

- Image1   label1 -

- Image2  label2  -

- Image3 label3   -

----------------------- 

3 Answers, 1 is accepted

Sort by
0
Richard Slade
Top achievements
Rank 2
answered on 11 Mar 2011, 12:02 PM
Hello BB,

This is the same principal as your previous post with using HTML Like formatting to display what you need on your button. In this case you could use something like the following exmaple

this.radButton1.Size = new Size(137, 67);
string html;
html = "<html>";
html += @"<br>";
html += @"<img src=""C:\Users\Richard\Documents\Resources\Image1.png""> <span style=""font-size:8.25"">Text 1</span><br>";
html += @"<img src=""C:\Users\Richard\Documents\Resources\Image2.png""> <span style=""font-size:8.25"">Text 1</span><br>";
html += @"<img src=""C:\Users\Richard\Documents\Resources\Image3.png""> <span style=""font-size:8.25"">Text 1</span><br>";  
html += "</html>";
this.radButton1.Text = html;

Hope this helps
Richard
0
Richard Slade
Top achievements
Rank 2
answered on 15 Mar 2011, 10:41 AM
Hello,

Did this help? If so please remember to mark as answer. If you need further assistance, please let me know.
Thanks
Richard
0
Stefan
Telerik team
answered on 16 Mar 2011, 09:19 AM
Hello BB,

Thank you for writing.

Another approach is to remove the ImageAndTextLayoutPanel that RadButton contains in its Children collection and add elements that suit your requirement. Here is a sample of this:
radButton1.ButtonElement.Children.RemoveAt(1);
 
LightVisualElement element1 = new LightVisualElement();
element1.Image = Image.FromFile(@"C:\Program Files (x86)\Telerik\RadControls for WinForms Q2 2010 SP2\Examples\Resources\SE.png");
element1.ShouldHandleMouseInput = false;
element1.ImageAlignment = ContentAlignment.BottomLeft;
element1.ImageLayout = ImageLayout.None;
 
LightVisualElement element2 = new LightVisualElement();
element2.Image = Image.FromFile(@"C:\Program Files (x86)\Telerik\RadControls for WinForms Q2 2010 SP2\Examples\Resources\SE.png");
element2.ShouldHandleMouseInput = false;
element2.ImageAlignment = ContentAlignment.MiddleLeft;
element2.ImageLayout = ImageLayout.None;
 
 
LightVisualElement element3 = new LightVisualElement();
element3.Image = Image.FromFile(@"C:\Program Files (x86)\Telerik\RadControls for WinForms Q2 2010 SP2\Examples\Resources\SE.png");
element3.ImageAlignment = ContentAlignment.TopLeft;
element3.ShouldHandleMouseInput = false;
element3.ImageLayout = ImageLayout.None;
 
LightVisualElement element4 = new LightVisualElement();
element4.ShouldHandleMouseInput = false;
element4.TextAlignment = ContentAlignment.BottomRight;
element4.Text = "test";
 
LightVisualElement element5 = new LightVisualElement();
element5.ShouldHandleMouseInput = false;
element5.TextAlignment = ContentAlignment.MiddleRight;
element5.Text = "test";
 
 
LightVisualElement element6 = new LightVisualElement();
element6.ShouldHandleMouseInput = false;
element6.TextAlignment = ContentAlignment.TopRight;
element6.Text = "test";
 
radButton1.ButtonElement.Children.Add(element1);
radButton1.ButtonElement.Children.Add(element2);
radButton1.ButtonElement.Children.Add(element3);
radButton1.ButtonElement.Children.Add(element4);
radButton1.ButtonElement.Children.Add(element5);
radButton1.ButtonElement.Children.Add(element6);

I hope this helps.

Best wishes,
Stefan
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Tags
Buttons, RadioButton, CheckBox, etc
Asked by
BB
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
Stefan
Telerik team
Share this question
or