Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
595
Adding a second image to an UltraTabControl
posted

Hi,

Is there a way to  add a second image (aligned right) to an UltraTabControl?

Something like in the attached image.

Thanks!

Parents
No Data
Reply
  • 21795
    Verified Answer
    Offline posted

    Hello Ziv,
    UltraTabControl allows you to add image to any tab via its Appearance. However, by default you can add only one image. If you need to add more images, you can achieve this by some custom Creation Filter. What you need to do in your creation filter is add to TabItemUIElements’ child elements ImageUIElement and set its location. You may use code like this in AfterCreateChildElements method of your creation filter:

    //  If the parent is TabItemUIElement add one ImageElement to its child collection
    if(parent is TabItemUIElement)
    {
        //  Create the ImageUIElement
        var imageElement = new ImageUIElement(parent, tabImage);
     
        //  Set the ImageUIElement Rect relative to its parent Rect
        imageElement.Rect = new Rectangle(parent.Rect.Right - 19, parent.Rect.Top + 3, 16, 16);
     
        //  Add the ImageUIElement to its parent child elements collection
        parent.ChildElements.Add(imageElement);
    }

    Note, this will add the image at the right end of each tab. This way the image may hide part of the tab text. To work around this you can add some additional blank text at the end of each tab like this:
    tabWithSecondImage.Text += "     .";

    Attached is small sample demonstrating this approach. Please check my sample and let me know if this is what you are looking for, or if I am missing something.

    UltraTabControlImagesInTab.zip
Children