I redefined some controls as Button, checkBox, RadioButton in C#.
In these controls, OnPaint method was overrided because I don't want to use 'base.OnPaint(pevent).
But I could not make the background of these controls transparent.
The background is always black! Q.Q
I tried to solve that problem with many documents in the Internet!
So I'm already using 'SetStryle(ControlStyles.SupportsTransparentBackColor, true)'.
But it was not a solution of my problem.

sourse code of OnPaint() is just like this...

protected override void OnPaint(PaintEventArgs pevent)
{
            this.BackColor = Color.Transparent;
            pevent.Graphics.FillRectangle(Brushes.White, 5, 5, this.Size.Width - 10, this.Size.Height - 10);
}

please help me to solve that problem.
Thank you for reading this text.

  • Moved byeryangMSFT2 hours 44 minutes agocustom control issue. (From:Common Language Runtime)
  •