Rad Button with 3 Images and 3 labels

4 posts, 0 answers
  1. BB
    BB avatar
    13 posts
    Member since:
    Mar 2007

    Posted 10 Mar 2011 Link to this post

    I need a button with 3 images and 3 labels.

    Thank you very much.

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

    - Image1   label1 -

    - Image2  label2  -

    - Image3 label3   -

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

  2. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 11 Mar 2011 Link to this post

    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
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 15 Mar 2011 Link to this post

    Hello,

    Did this help? If so please remember to mark as answer. If you need further assistance, please let me know.
    Thanks
    Richard
  5. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 16 Mar 2011 Link to this post

    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!
Back to Top