Hi,
->have a tiny borderless form with tiny buttons on it. I want the buttons to not receive focus (no box around them) when you click them. Also, I want a tool tip to show when you hover over each button.
You need to create a custom button. This button will filter the button click message. For example:
private void Form1_Load(object sender, EventArgs e)
{
mybutton1.TabStop = false;
ToolTip tip1 = new ToolTip();
foreach (Control con in this.Controls)
{
if (con is mybutton)
{
tip1.SetToolTip(con, "MyButton");
}
}
}
}
public class mybutton : Button
{
const int WM_LBUTTONDOWN = 0x0201;
const int WM_LBUTTONDBLCLK = 0x203;
protected override void WndProc(ref Message m)
{
if (m.Msg != WM_LBUTTONDOWN && m.Msg != WM_LBUTTONDBLCLK)
base.WndProc(ref m);
}
}
Best regards,
Ling Wang
Please remember to click “Mark as Answer�on the post that helps you, and to click “Unmark as Answer�if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.