Posted 20 years ago by Matt
Avatar
Is it possible to put a border right around a tabstrip page ?

Comments (3)

Posted 20 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Certainly... you can draw the tabstrip however you would like. In the VisualStudio2005ToolWindowTabStripRenderer we draw borders around the pages.

You can inherit from one of our renderers if you want to do it your own way and override the DrawTabStripBackground method. Then by looking at some of the properties of the renderer you can determine where to draw.


Actipro Software Support

Posted 20 years ago by Matthew Dalton
Avatar
do you have any samples i could look at to figure this out ?
Posted 20 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Here's our code for the VisualStudio2005ToolWindowTabStripRenderer:
public override void DrawTabStripBackground(PaintEventArgs e, Rectangle bounds, TabStrip tabStrip) {
    // Fill the background
    tabStripBackgroundFill.Draw(e.Graphics, bounds, TabStrip.GetSidesFromTabStripTabAlignment(tabStrip.TabAlignment));

    // Fill in the tab container
    Rectangle tabContainerBounds;
    switch (tabStrip.TabAlignment) {
        case TabStripTabAlignment.Left:
            tabContainerBounds = new Rectangle(bounds.Left, bounds.Top, 
                this.TabStripTabOuterMargin + tabStrip.TabAscent, bounds.Height);
            break;
        case TabStripTabAlignment.Right:
            tabContainerBounds = new Rectangle(
                bounds.Right - (this.TabStripTabOuterMargin + tabStrip.TabAscent), 
                bounds.Top, this.TabStripTabOuterMargin + tabStrip.TabAscent, bounds.Height);
            break;
        case TabStripTabAlignment.Bottom:
            tabContainerBounds = new Rectangle(bounds.Left, 
                bounds.Bottom - (this.TabStripTabOuterMargin + tabStrip.TabAscent), bounds.Width, 
                this.TabStripTabOuterMargin + tabStrip.TabAscent);
            break;
        default: // Top
            tabContainerBounds = new Rectangle(bounds.Left, bounds.Top, bounds.Width, 
                this.TabStripTabOuterMargin + tabStrip.TabAscent);
            break;
    }
    tabStripTabContainerBackgroundFill.Draw(e.Graphics, tabContainerBounds, TabStrip.GetSidesFromTabStripTabAlignment(tabStrip.TabAlignment));

    // Draw a border
    Pen borderPen = new Pen(this.TabStripTabSelectedBorderColor);
    switch (tabStrip.TabAlignment) {
        case TabStripTabAlignment.Left:
            e.Graphics.DrawLine(borderPen, bounds.Left + (this.TabStripTabOuterMargin + tabStrip.TabAscent - 1), bounds.Top, 
                bounds.Left + (this.TabStripTabOuterMargin + tabStrip.TabAscent - 1), bounds.Bottom - 1);
            break;
        case TabStripTabAlignment.Right:
            e.Graphics.DrawLine(borderPen, bounds.Right - (this.TabStripTabOuterMargin + tabStrip.TabAscent - 1) - 1, bounds.Top, 
                bounds.Right - (this.TabStripTabOuterMargin + tabStrip.TabAscent - 1) - 1, bounds.Bottom - 1);
            break;
        case TabStripTabAlignment.Bottom:
            e.Graphics.DrawLine(borderPen, bounds.Left, bounds.Bottom - (this.TabStripTabOuterMargin + tabStrip.TabAscent - 1) - 1, 
                bounds.Right - 1, bounds.Bottom - (this.TabStripTabOuterMargin + tabStrip.TabAscent - 1) - 1);
            break;
        default: // Top
            e.Graphics.DrawLine(borderPen, bounds.Left, bounds.Top + (this.TabStripTabOuterMargin + tabStrip.TabAscent - 1), 
                bounds.Right - 1, bounds.Top + (this.TabStripTabOuterMargin + tabStrip.TabAscent - 1));
            break;
    }
    borderPen.Dispose();
}


Actipro Software Support

The latest build of this product (v24.1.1) was released 3 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.