this is my code for the component. I got the solution to make the backcolor transparent from the Microsoft website, and from stack overflow but it doesn't work:
public RedCircle()
{
SetStyle(ControlStyles.SupportsTransparentBackColor, true);
this.BackColor = Color.Transparent;
InitializeComponent();
this.Paint += new PaintEventHandler(RedCircle_Paint);
}
private void RedCircle_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
g.FillEllipse(Brushes.Red, new Rectangle(5, 5, 25, 25));
}
End result on form:
Aucun commentaire:
Enregistrer un commentaire