- 积分
- 40165
- 好友
- 记录
- 主题
- 帖子
- 听众
- 收听
|
发表于 2013-8-30 14:47:55
|
显示全部楼层
[code=csharp]using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Winfrom
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
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 = 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);
}
}
}
[/code]
|
|