VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,841 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello,
I have difficulties hiding the focus cues around the tab page items of TabControl.
Here seems possible:
https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.tabcontrol?view=netframework-4.8
But my code won't work, anyone can help please? :)
Friend Class _TabControl
Inherits Windows.Forms.TabControl
Public Sub New()
MyBase.New()
Font = New Font("Segoe UI", 9)
End Sub
Protected Overrides ReadOnly Property ShowFocusCues As Boolean
Get
Return False
End Get
End Property
End Class
This seems to work on my Windows 10 OS :
Friend Class _TabControl
Inherits Windows.Forms.TabControl
Public Sub New()
MyBase.New()
Font = New Font("Segoe UI", 9)
End Sub
Protected Overrides ReadOnly Property ShowFocusCues As Boolean
Get
Return False
End Get
End Property
Protected Overrides Sub OnHandleCreated(e As EventArgs)
MyBase.OnHandleCreated(e)
Me.TabStop = False
End Sub
End Class
Protected Overrides Sub WndProc(ByRef m As Message)
Const WM_UPDATEUISTATE As Integer = &H128
Const UISF_HIDEFOCUS As Integer = &H1
Const UIS_SET As Integer = &H1
If m.Msg = WM_UPDATEUISTATE Then
' Force UI to always hide focus cues
m.WParam = CType((UIS_SET Or (UISF_HIDEFOCUS << 16)), IntPtr)
End If
MyBase.WndProc(m)
End Sub