Groups | Blog | Home
all groups > dotnet compact framework > february 2005 >

dotnet compact framework : transparent label...


Tim Wilson
2/4/2005 12:15:39 PM
I assume that the OnPaint override is for a Form? Do you actually have a
Label named "label1" on the Form and if so does it have a Size? If so then
you might be drawing under your label. Also make sure that "label1.Text"
contains some text. Try drawing at 0,0 and see if that helps. Oh and don't
forget to Dispose of objects when you are done with them.

--
Tim Wilson
..Net Compact Framework MVP

[quoted text, click to view]

Mustafa Rabie
2/4/2005 6:47:30 PM
hi all,

i know that transparent labels are not supported in netcf. So i added my
text in OnPaint, but actually the text is still not showing.. what am i
doing wrong? here's the OnPaint code:

protected override void OnPaint(PaintEventArgs e)

{

Graphics g = e.Graphics;

System.Drawing.Font f = new Font("Nina",
8,System.Drawing.FontStyle.Regular);

g.DrawString(this.label1.Text, this.label1.Font, new
System.Drawing.SolidBrush(System.Drawing.Color.Red), this.label1.Location.X,
this.label1.Location.Y );



base.OnPaint(e);

}

thanks

Mustafa

Peter Foot [MVP]
2/4/2005 7:06:11 PM
In that case the text is behind the PictureBox. You'll need to draw that
image in your OnPaint too (before you draw the text). Any control you add to
the form is drawn on top of whatever is in your forms OnPaint.

Peter

--
Peter Foot
Windows Embedded MVP
www.inthehand.com | www.opennetcf.org

[quoted text, click to view]

Mustafa Rabie
2/4/2005 8:48:32 PM
hi
i tried to put it @ 0,0 but still it's not showing anything, and yes i do
have a label1 that has text in it.
Did i mention that i have a picture box set as the form's background? the
setup is
Form, with a picture box (same size of the form) and i want to show the text
over it.

thanks
mustafa
[quoted text, click to view]

AddThis Social Bookmark Button