When a button is focused by pressing Tab key, a rectangle appears on
it. Even if the button's TabStop property is set to false, when the
button is clicked with mouse the rectangle appears. Is it possible to
stop the rectangle from appearing? Please help. Regards.

This is because the focus still on the button.

On the button click event, you can set the focus to another control to 'remove' the rectangle

Hope this helps.

Hi,

You can do it like this:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
     TextBox1.Focus()
     ' put your code for the button click event here
End Sub

Edited 6 Years Ago by Luc001: n/a

class CustomButton : System.Windows.Forms.Button
   {
       private bool _DisplayFocusCues = true;
       protected override bool ShowFocusCues
       {
           get
           {
               return _DisplayFocusCues;
           }
       }

       public bool DisplayFocusCues
       {
           get
           {
               return _DisplayFocusCues;
           }
           set
           {
               _DisplayFocusCues = value;
           }
       }
   }

Using this class you can set DisplayFocusCues at design time too.

This question has already been answered. Start a new discussion instead.