tabcontrol的alignment属性设置成Right时,tabPage的text内容怎么显示成竖着的字体
亲自测试过,成功。
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)); 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); }