* UITabControl:标题垂直居中

This commit is contained in:
Sunny 2020-08-12 23:29:18 +08:00
parent 0b14ac5465
commit 1002b92cb0
6 changed files with 2 additions and 3 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -69,7 +69,7 @@
this.uiTabControl1.Controls.Add(this.tabPage12); this.uiTabControl1.Controls.Add(this.tabPage12);
this.uiTabControl1.Controls.Add(this.tabPage13); this.uiTabControl1.Controls.Add(this.tabPage13);
this.uiTabControl1.DrawMode = System.Windows.Forms.TabDrawMode.OwnerDrawFixed; this.uiTabControl1.DrawMode = System.Windows.Forms.TabDrawMode.OwnerDrawFixed;
this.uiTabControl1.Font = new System.Drawing.Font("微软雅黑", 12F); this.uiTabControl1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiTabControl1.ItemSize = new System.Drawing.Size(150, 40); this.uiTabControl1.ItemSize = new System.Drawing.Size(150, 40);
this.uiTabControl1.Location = new System.Drawing.Point(30, 52); this.uiTabControl1.Location = new System.Drawing.Point(30, 52);
this.uiTabControl1.MenuStyle = Sunny.UI.UIMenuStyle.Custom; this.uiTabControl1.MenuStyle = Sunny.UI.UIMenuStyle.Custom;
@ -201,7 +201,6 @@
this.uiTabControlMenu1.Size = new System.Drawing.Size(670, 239); this.uiTabControlMenu1.Size = new System.Drawing.Size(670, 239);
this.uiTabControlMenu1.SizeMode = System.Windows.Forms.TabSizeMode.Fixed; this.uiTabControlMenu1.SizeMode = System.Windows.Forms.TabSizeMode.Fixed;
this.uiTabControlMenu1.TabIndex = 21; this.uiTabControlMenu1.TabIndex = 21;
this.uiTabControlMenu1.TextAlignment = System.Windows.Forms.HorizontalAlignment.Center;
// //
// tabPage5 // tabPage5
// //

View File

@ -422,7 +422,7 @@ namespace Sunny.UI
g.FillRectangle(TabSelectedHighColor, 0, bmp.Height - 4, bmp.Width, 4); g.FillRectangle(TabSelectedHighColor, 0, bmp.Height - 4, bmp.Width, 4);
} }
g.DrawString(TabPages[index].Text, Font, index == SelectedIndex ? tabSelectedForeColor : TabUnSelectedForeColor, textLeft, TabRect.Top + 2 + (TabRect.Height - sf.Height) / 2.0f); g.DrawString(TabPages[index].Text, Font, index == SelectedIndex ? tabSelectedForeColor : TabUnSelectedForeColor, textLeft, TabRect.Top + 2 + (TabRect.Height - sf.Height - 4) / 2.0f);
var menuItem = Helper[index]; var menuItem = Helper[index];
bool showButton = menuItem == null || !menuItem.AlwaysOpen; bool showButton = menuItem == null || !menuItem.AlwaysOpen;