Comment faire pour changer d'Onglet de Contrôle de la Couleur d'arrière-plan (VB.NET)
comment puis-je changer la partie grise en couleur blanche?
Je veux que mon tabcontrol rempli avec plein de couleur blanche.
Pour l'instant ce que j'ai fait, c'est comme cela:
Private Sub TabControl1_DrawItem(ByVal sender As 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)
sf.Alignment = StringAlignment.Center
Dim strTitle As String = tp.Text
'If the current index is the Selected Index, change the color
If TabControl1.SelectedIndex = e.Index Then
'this is the background color of the tabpage header
br = New SolidBrush(Color.White) ' chnge to your choice
g.FillRectangle(br, e.Bounds)
'this is the foreground color of the text in the tab header
br = New SolidBrush(Color.Black) ' change to your choice
g.DrawString(strTitle, TabControl1.Font, br, r, sf)
Else
'these are the colors for the unselected tab pages
br = New SolidBrush(Color.White) ' Change this to your preference
g.FillRectangle(br, e.Bounds)
br = New SolidBrush(Color.Black)
g.DrawString(strTitle, TabControl1.Font, br, r, sf)
End If
End Sub
et j'ai aussi mis ce à PageLoad fonction:
TabControl1.DrawMode = TabDrawMode.OwnerDrawFixed
For Each tg As TabPage In TabControl1.TabPages
tg.BackColor = Color.White
Next
Vous devez vous connecter pour publier un commentaire.
Il n'y a pas de propriété pour ce faire. Toutefois, il est possible en utilisant quelque chose comme ceci
http://dotnetrix.co.uk/tabcontrol.htm
Toutes les commandes sur ce site sont librement disponible sous licence MIT.
Dépenses juste le temps de faire des recherches si quelqu'un à trouver une solution; Il pourrait y avoir quelques travaux autour de. Mais selon MSDN Ref.
TabControl.Propriété BackColor
Pour autant que je comprends, c'est réglable par l'utilisateur paramètre windows. (
Highlight Color
) deTabControl
, des Formulaires et d'autres contrôles; sinon MS pourrait tout simplement faire de cette propriété sur.