All Forums
 Microsoft Windows CE
 .NET Application Development
 PaintEventHandler for label or button
 Forum Locked
 Send Topic to a Friend
 Printer Friendly
Author Topic  

mhuman1

36 Posts

Posted - 23 Dec 2004 :  12:54:23  Show Profile  Email Poster


Hi,
I am trying to do some tricks with buttons and labels. I want to use the paint event to do drawing on a button or label when it is painted.
I am trying to use the PaintEventHandler to do this. In the constructor for my form I added two PaintEventHandler delegates, one for the form and one for the label.
The Form delegate works fine, it prints the message “Hello mum” in nice large red letters on the form. The one for the delegate doesn’t (as far as I can tell). The label simply draws with its default text (“label1”). The code is shown below. Any ideas??




public Form1()

{
//
// Required for Windows Form Designer support
//
InitializeComponent();

// My test
this.Paint +=new PaintEventHandler(Form1_Paint);
this.label1.Paint +=new PaintEventHandler(label1_Paint);
//

}



private static void Form1_Paint(object sender , PaintEventArgs e)
{
// Get graphics object
Graphics g = e.Graphics;

g.DrawString("Hello Mum!",new Font("Verdana",20,FontStyle.Regular),new SolidBrush(Color.Tomato),40,40);

}

private static void label1_Paint(object sender , PaintEventArgs e)
{
// Get graphics object
Graphics g = e.Graphics;
Font fnt = new Font("Veranda",20,FontStyle.Regular);

g.DrawString("Hello Mum!",new Font("Verdana",20,FontStyle.Regular),new SolidBrush(Color.Tomato),1,1);

}
Thanks,
Keith Stallings

akidder

1519 Posts

Posted - 28 Dec 2004 :  13:02:21  Show Profile  Email Poster
Hi Keith. Thanks for the code and note. Have you considered posting this question to one of the news groups? The How do I...? forum of OpenNetCF.org could be one place to start.
Go to Top of Page
  Topic  
 Forum Locked
 Send Topic to a Friend
 Printer Friendly
Jump To:
Eurotech Support Forums © Eurotech Inc. Go To Top Of Page
This page was generated in 0.03 seconds. Snitz Forums 2000