Create invisible clickable button
3 answers
try it
private void CreateButton()
{
button1 = new Button();
button1.FlatAppearance.BorderSize = 0;
button1.FlatAppearance.MouseDownBackColor = Color.Transparent;
button1.FlatAppearance.MouseOverBackColor = Color.Transparent;
button1.FlatStyle = FlatStyle.Flat;
button1.ForeColor = BackColor;
button1.Location = new Point(197, 226); //Give your own location as needed
button1.Name = "button1";
button1.Size = new Size(75, 23);
button1.TabIndex = 0;
button1.Text = "button1";
button1.UseVisualStyleBackColor = true;
button1.Click += this.button1_Click;
Controls.Add(button1);
}
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show("clicked");
}
+3
source to share
Start by dragging a new button from the toolbar. By fetching the list of properties instead of doing it manually with code, changing the following parameters should give you the desired result.
| Property | Settings |
---------------------------------------------------
| BackColor | Transparent |
| FlatStyle | Flat |
| FlatAppearance.MouseDownBackColor | Transparent |
| FlatAppearance.MouseOverBackColor | Transparent |
| ForeColor | Transparent |
| UseVisualStyleBackColor | False |
0
source to share