Problem in button (.Net 2008, Framework 3.5).
-
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.
-
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.
What exactly are you trying to do? The
TabStop
property only determines whether the control can be selected using the Tab key. Obviously using the mouse by passes that, so it is behaving as expected. Do you perhaps want to disable the control (Enabled = false;
) or hide it (Visible = false;
) or just not provide user feedback that it's selected?CQ de W5ALT
Walt Fair, Jr., P. E. Comport Computing Specializing in Technical Engineering Software
-
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.
Owner-drawing? ..or the ImageButton from the VB PowerPack[^] - it has a
ShowFocusRect
property :) By hiding the focus, the user won't know what control will be reacting to key-presses. It'd make a very confusing user-experience.I are Troll :suss:
-
Owner-drawing? ..or the ImageButton from the VB PowerPack[^] - it has a
ShowFocusRect
property :) By hiding the focus, the user won't know what control will be reacting to key-presses. It'd make a very confusing user-experience.I are Troll :suss:
By inheriting the standard button class here's another solution I came up to:
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.
-
By inheriting the standard button class here's another solution I came up to:
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.
-
By inheriting the standard button class here's another solution I came up to:
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.
Nice! /ravi
My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com
-
By inheriting the standard button class here's another solution I came up to:
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.
yup! that's one of the perfect way to set DisplayFocus at design time :)