Posted 20 years ago
by Matt
Is it possible to put a border right around a tabstrip page ?
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();
}
Please log in to a validated account to post comments.