PaintBox Paint event

U

user

hello
I have:
public void MyFunction(PictureBox b, PaintEventArgs e)

how can i set from code this function as PaintBox Paint Event handler ?
I tried:
box.Paint=MyFunction() and similar but always received errors..

Thanx
Michal
 
G

Guest

PictureBox pb = new PictureBox()
pb.Paint += new EventHandler(MyMethod)

private void MyMethod(object sender, PaintEventArgs e

Graphics g = e.Graphics

// et


Bear in mind that this will not modify the image in the picture box, but merely paint stuff over the top of the picture box when refreshed

Hope that help

jax
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top