关tabcontrol Alignment 属性 为 left时文字竖向显示  

private Rectangle tabArea;

private RectangleF tabTextArea ;

private void frmopen_Load(object sender, System.EventArgs e)

{

this.tabControl1.DrawMode = TabDrawMode.OwnerDrawFixed;

}

private void tabControl1_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e)

{

tabArea = tabControl1.GetTabRect(e.Index);

tabTextArea = RectangleF.op_Implicit(tabControl1.GetTabRect(e.Index));
//tabTextArea = tabControl1.GetTabRect(e.Index);
Graphics g = e.Graphics;

StringFormat sf = new StringFormat();

sf.LineAlignment = StringAlignment.Center;

sf.Alignment = StringAlignment.Center;

Font font = this.tabControl1.Font ;

SolidBrush brush = new SolidBrush(Color.Black);

g.DrawString(((TabControl)(sender)).TabPages[e.Index].Text, font, brush, tabTextArea, sf);

}

欢迎大佬支持本博客的发展 -- Donate --

本文链接:关tabcontrol Alignment 属性 为 left时文字竖向显示

转载声明:本站文章若无特别说明,皆为原创,转载请注明来源:三十岁,谢谢!^^


分享到:          
  1. 没有评论

  1. 没有通告