public void button1_Click(object sender, EventArgs e)
{
Form1 f1 = new Form1();
f1.DrawString();
}
All the rest is as generated by the IDE.
The button click works fine, but it does not call DrawString () method.
public void button1_Click(object sender, EventArgs e)
{
Form1 f1 = new Form1();
f1.DrawString();
}
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Posted Sep 26, 2010, 3:17 PM
You don't have to create an object for methods inside the same class....Just call DrawString()..it would work fine...
I also want u to check whether the method is inside the same class as told by u....
With Regards
P.Krishna Prasad
JurePosted Sep 27, 2010, 8:14 PM
Add this lambda expression to your button-click method
this.Paint += (object o, PaintEventArgs e) => {
e.Graphics.DrawString(/*...*/);
e.Graphics.Draw...
...
};