Skip to content

Commit

Permalink
* TabControl.cs (CalcXPos): New helper method so we can determine
Browse files Browse the repository at this point in the history
	the proper place to start drawing vertical tabs.
	* ThemeWin32Classic.cs (DrawTab): Draw right aligned tabs.

svn path=/trunk/mcs/; revision=35937
  • Loading branch information
Jackson Harper committed Nov 10, 2004
1 parent 9aa6a02 commit 026ca88
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 3 deletions.
@@ -1,3 +1,9 @@
2004-11-09 Jackson Harper <jackson@ximian.com>

* TabControl.cs (CalcXPos): New helper method so we can determine
the proper place to start drawing vertical tabs.
* ThemeWin32Classic.cs (DrawTab): Draw right aligned tabs.

2004-11-09 Jackson Harper <jackson@ximian.com>

* TabControl.cs: Calculate sizing and rects for left aligned tabs.
Expand Down
Expand Up @@ -570,6 +570,16 @@ private int CalcYPos ()
return 1;
}

private int CalcXPos ()
{
if (Alignment == TabAlignment.Right) {
Rectangle r = ThemeEngine.Current.GetTabControlDisplayRectangle (this);
return r.Right + 4;
}
return 4;

}

private void SizeTabs ()
{
switch (Alignment) {
Expand All @@ -589,7 +599,7 @@ private void SizeTabsV (int row_width)
int prev_row = 1;
Size spacing = TabSpacing;
int size = item_size.Height + 2 + spacing.Width;
int xpos = 4;
int xpos = CalcXPos ();

if (TabPages.Count == 0)
return;
Expand Down
Expand Up @@ -26,9 +26,14 @@
//
//
//
// $Revision: 1.62 $
// $Revision: 1.63 $
// $Modtime: $
// $Log: ThemeWin32Classic.cs,v $
// Revision 1.63 2004/11/10 01:04:28 jackson
// * TabControl.cs (CalcXPos): New helper method so we can determine
// the proper place to start drawing vertical tabs.
// * ThemeWin32Classic.cs (DrawTab): Draw right aligned tabs.
//
// Revision 1.62 2004/11/09 21:44:54 jackson
// * TabControl.cs: Calculate sizing and rects for left aligned tabs.
// * ThemeWin32Classic.cs (GetTabControl*ScrollRect): Only handle Top
Expand Down Expand Up @@ -2067,7 +2072,32 @@ private int DrawTab (Graphics dc, TabPage page, TabControl tab, Rectangle bounds
break;

default:
throw new Exception ("right tabs");
// TabAlignment.Right

dc.FillRectangle (GetControlBackBrush (tab.BackColor), bounds);

dc.DrawLine (light, bounds.Left, bounds.Top, bounds.Right - 3, bounds.Top);
dc.DrawLine (light, bounds.Right - 3, bounds.Top, bounds.Right, bounds.Top + 3);

dc.DrawLine (SystemPens.ControlDark, bounds.Right - 1, bounds.Top + 1, bounds.Right - 1, bounds.Bottom - 1);
dc.DrawLine (SystemPens.ControlDark, bounds.Left, bounds.Bottom - 1, bounds.Right - 2, bounds.Bottom - 1);

dc.DrawLine (SystemPens.ControlDarkDark, bounds.Right, bounds.Top + 3, bounds.Right, bounds.Bottom - 3);
dc.DrawLine (SystemPens.ControlDarkDark, bounds.Left, bounds.Bottom, bounds.Right - 3, bounds.Bottom);

interior = new Rectangle (bounds.Left + 4, bounds.Top + 4, bounds.Width - 8, bounds.Height - 8);

if (page.Text != String.Empty) {
StringFormat string_format = new StringFormat ();
string_format.Alignment = StringAlignment.Center;
string_format.LineAlignment = StringAlignment.Center;
string_format.FormatFlags = StringFormatFlags.NoWrap;
string_format.FormatFlags = StringFormatFlags.DirectionVertical;
interior.X++;
dc.DrawString (page.Text, page.Font, new SolidBrush (SystemColors.ControlText), interior, string_format);
}

break;
}
}

Expand Down

0 comments on commit 026ca88

Please sign in to comment.