Saturday, January 16, 2016

How to make the background transparent controls when using C # development of mobile programs?




            


I used a custom control on FORM. I was in the control overloaded OnPaint event to draw a circle. And with the following wording reload OnPaintbackgroud event:
protected override void OnPaintBackground (PaintEventArgs e)
{
return;
}

But after running FORM found in the control it is transparent, but also transparent background FORM. .
Members experts to help, teach me how to do just FORM controls transparent but opaque ah!
Reply:
FORM is already transparent, no background on transparent
Reply:
Bangding
Reply:
private void frmMain_Load (object sender, System.EventArgs e)
{

picbackgroup.Dock = DockStyle.Fill;
picbackgroup.BackColor = Color.White;
picbackgroup.Paint + = new System.Windows.Forms.PaintEventHandler (this.picbackgroup_Paint);
this.Controls.Add (picbackgroup);
}
private void picbackgroup_Paint (object sender, System.Windows.Forms.PaintEventArgs e)
{
Graphics g = e.Graphics;
Brush b = new SolidBrush (Color.White);
g.DrawString (strDraw, this.Font, b, 2,2);
g.DrawString (strMsg, this.Font, b, 2,10);

}

NOTE: picbackgroup to picturebox, realize the function of writing his words on picturebox. Label it be transparent.
Reply:
3rd floor, good approach.
Reply:
I also want to know, thank LZ.

No comments:

Post a Comment