1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| Private Sub TabControl1_DrawItem(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles TabControl1.DrawItem
Dim g As Graphics = e.Graphics
Dim tp As TabPage = TabControl1.TabPages(e.Index)
Dim br As Brush
Dim sf As New StringFormat
Dim r As New RectangleF(e.Bounds.X, e.Bounds.Y + 2, e.Bounds.Width, e.Bounds.Height - 2)
Dim strTitle As String = tp.Text
Try
If Not tp.Controls(0) Is Nothing Then
If CType(tp.Controls(0), tabPageColis).isValided And CType(tp.Controls(0), tabPageColis).isPrinted Then
br = New SolidBrush(Color.Green)
g.FillRectangle(br, e.Bounds)
br = New SolidBrush(tp.ForeColor)
g.DrawString(strTitle, TabControl1.Font, br, r, sf)
tp.Tag = True
ElseIf CType(tp.Controls(0), tabPageColis).isValided Then
br = New SolidBrush(Color.Yellow)
g.FillRectangle(br, e.Bounds)
br = New SolidBrush(tp.ForeColor)
g.DrawString(strTitle, TabControl1.Font, br, r, sf)
tp.Tag = True
Else
br = New SolidBrush(Color.White)
g.FillRectangle(br, e.Bounds)
br = New SolidBrush(tp.ForeColor)
g.DrawString(strTitle, TabControl1.Font, br, r, sf)
tp.Tag = False
End If
End If
Catch ex As Exception
End Try
End Sub |