C# winform tabControl1重绘选项卡

DrawItem事件
 1  /// <summary>
 2         /// 绘制选项卡
 3         /// </summary>
 4         /// <param name="sender"></param>
 5         /// <param name="e"></param>
 6         private void tabControl1_DrawItem(object sender, DrawItemEventArgs e)
 7         {
 8             Bitmap b0 = new Bitmap(@"..\..\images\QQ截图20170609092336.png");
 9             Bitmap b1 = new Bitmap(@"..\..\images\QQ截图20170609092301.png");
10             Bitmap b2 = new Bitmap(@"..\..\images\QQ截图20170612162225.png");
11             Bitmap b3 = new Bitmap(@"..\..\images\QQ截图20170618235659.png");
12             switch (e.Index)
13             {
14                 case 0:
15                     e.Graphics.DrawImage(b0, e.Bounds);
16                     break;
17                 case 1:
18                     e.Graphics.DrawImage(b1, e.Bounds);
19                     break;
20                 case 2:
21                     e.Graphics.DrawImage(b2, e.Bounds);
22                     break;
23                 case 3:
24                     e.Graphics.DrawImage(b3, e.Bounds);
25                     break;
26             }
27         }
View Code

 

posted @ 2017-07-07 09:11  显示名称已被使用!!!  阅读(1632)  评论(0)    收藏  举报