Creating layers ontop of an image?

DustinS

New member
Joined
Jan 16, 2007
Messages
2
Programming Experience
Beginner
I'd like to use a PictureBox (but it doesn't have to be a picbox) to open an image, and then create transparent layers ontop of the image so that I can draw, add other smaller images, etc, etc, on of the "base image".

Does anyone know of a technique for doing something such as this?
 
Controls already feature this "layer", its called the Paint event. What you draw here is painted on top of what the control is already displaying. You can in code force this event to happen by calling the controls Refresh or Invalidate(rectangle) methods, otherwise it will happen (paint) when needed by windows (for example when window moved or something moved over it).
 
I Don't Understand

Hello John, in order to make sure we're on the same page.... if I have a PictureBox with a picture in it, sure, I can draw a rectangle and fill it. But let's say I want to draw 4 rectangles, and then add another layer, and then draw a grid on that layer. I'd like the user to be able show and hide the grid (which is made up of a series of horizontal and vertical lines, which are all grouped together and managed as one object). Then I want to create another layer, add more rectangles to it, and manage those rectangle seperately from the first ones that I added.

Are you saying this "feature" is already built into the PictureBox control (or any other control for that matter)? And if so, can you point me somewhere that explains how this is done?

Thanks...
 
I'm saying the picturebox control can display an image and that you at the same time can draw on top of that with the Paint event without affecting the "background image".

If you are saying you want a lot of custom image layers user can turn on and off you have to manage them yourself.

Look into the System.Drawing namespaces, especially the Graphics class. Also check this site Bob Powell GDI+ FAQ very useful for beginners and others too.
 
Back
Top