回答編集履歴
1
追記
test
CHANGED
@@ -1 +1,73 @@
|
|
1
1
|
タブコントロールのタブをオーナードローすれば、変更できますよ。
|
2
|
+
|
3
|
+
```
|
4
|
+
|
5
|
+
Public Class Form1
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
|
10
|
+
|
11
|
+
'タブコントロールの描画モードをオーナードローに変更
|
12
|
+
|
13
|
+
TabControl1.DrawMode = TabDrawMode.OwnerDrawFixed
|
14
|
+
|
15
|
+
End Sub
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
Private Sub TabControl1_DrawItem(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles TabControl1.DrawItem
|
20
|
+
|
21
|
+
Dim backBrush As SolidBrush
|
22
|
+
|
23
|
+
Dim foreBrush As SolidBrush
|
24
|
+
|
25
|
+
Dim font As Font
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
'背景や文字色、フォントは自由に設定してください
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
If TabControl1.SelectedIndex = e.Index Then
|
34
|
+
|
35
|
+
backBrush = New SolidBrush(Color.Navy)
|
36
|
+
|
37
|
+
foreBrush = New SolidBrush(Color.White)
|
38
|
+
|
39
|
+
font = New Font("Arial Black", 11, FontStyle.Bold)
|
40
|
+
|
41
|
+
Else
|
42
|
+
|
43
|
+
backBrush = New SolidBrush(SystemColors.Control)
|
44
|
+
|
45
|
+
foreBrush = New SolidBrush(Color.Black)
|
46
|
+
|
47
|
+
font = New Font("Arial Black", 11, FontStyle.Regular)
|
48
|
+
|
49
|
+
End If
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
Dim format As StringFormat = New StringFormat()
|
54
|
+
|
55
|
+
Dim rect As RectangleF = New RectangleF(e.Bounds.X, e.Bounds.Y + 6, e.Bounds.Width, e.Bounds.Height)
|
56
|
+
|
57
|
+
format.Alignment = StringAlignment.Center
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
e.Graphics.FillRectangle(backBrush, e.Bounds)
|
62
|
+
|
63
|
+
e.Graphics.DrawString(TabControl1.TabPages(e.Index).Text, font, foreBrush, rect, format)
|
64
|
+
|
65
|
+
End Sub
|
66
|
+
|
67
|
+
End Class
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
```
|