drawing on picture box

  • Thread starter Thread starter jack
  • Start date Start date
J

jack

hi all can any one help me in this
i want to draw a default picture on a picture box whenever i click
on a new button. please help ...
 
probably the easiest way to achieve this is to sub-class the button class,
and override the paint method to paint in your custom image.
Graphics.DrawImage() should work, but you will need to code in sizing stuff
for your image... I'd write some out for you, but I'm toooo tired. You
should be able to google some examples of how to override the paint method
properly.
 
Jack,

This is easy. Create a new Bitmap instance, and then get the Graphics
instance by passing the bitmap to the static FromImage method on the
Graphics class. This will return a Graphics instance you can use to draw on
the image.

Once you have that, you can set the PictureBox to show the image that
you created.

Hope this helps.
 
Back
Top