Asked By
J Richard
0 points
N/A
Posted on - 08/22/2011
I am making a complex application of image processing in Visual Studio 2010.
I want to have a layering effect in my Application just like in Photoshop.
Just like this, so that users can click on each layer and edit it accordingly.
Do I have to create a new User control or it is possible to do this with predefined control of Visual studio like Picture Viewer?
How to create layering feature in the PictureBox using C#
To create layering feature in picture box using C # use this code.
Bitmap NewPicture = newBitmap(Database.Folder + "\Resources\Minimaps\"+ msg.MapName + ".bmp");
Graphics gBmp = Graphics.FromImage(NewPicture);
floatRatio = ((float)msg.MaxSize / (float)512);
UInt16 x = (UInt16)(msg.CharX);
UInt16 y = (UInt16)(msg.CarY)h;
Rectangle rect = newRectangle((x – (Thickness / 2)), (y – (Thickness / 2)), Thickness, Thickness);
gBmp.FillRectangle(Brush, rect);
this.MapPictureBox.Image = NewPicture;
Â
Now for insert image in this picture box use this code:
this.PictureBox.BackgroundImage = map;
Then if you thought you could make a new map layer
Bitmap MapLayer = newBitmap(512, 512);
Draw on it with your own functions and lastly
this.PictureBox.Image = MapLayer;
Â