Trying to disguise mouse entry highlighting

Poppa Mintin

Well-known member
Joined
Jan 4, 2018
Messages
45
Programming Experience
10+
Hi,

I'm using buttons as a textbox or label so that I can set the TextAlign to middle centre, something I can't do with other controls. Sadly though, it's a bit distracting when the button highlights as the cursor passes over it, especially for a user who has no reason to believe the button is anything other than a label.

I'm trying to stop the buttons showing focus just because the cursor is crossing over them. I can't find any button property to use that might accomplish this, so I thought maybe setting the button back colour to it's own back colour might do it... But, no, it still highlights.

VB.NET:
    Private Sub SetForm()
        Dim but As Button, txt As String
        Me.TableLayoutPanel1.BackColor = Color.Tan
        For i = 1 To 25
            txt = "Button" & i.ToString
            but = CType(TableLayoutPanel1.Controls(txt), Button)
            but.Font = Form1.butFont
            but.Text = Form1.initial
            AddHandler but.MouseEnter, AddressOf ButNter
        Next
    End Sub


    Private Sub ButNter(sender As Object, e As EventArgs)
        CType(sender, Button).BackColor = Color.Tan
    End Sub
I've run out of ideas. Any help out there ?


Poppa.
 
I'm using buttons as a textbox or label so that I can set the TextAlign to middle centre, something I can't do with other controls.

Um, you can do that with a Label. Did you try? Did you perhaps not set AutoSize to False?
 

Latest posts

Back
Top