I'm making simple tilemap editor for my game, and i'd like to know how to do it.
This is my problem:
I need to find suitable control to act as a "drawing" surface. When i have selected a bitmap from listview, and and click to that surface, bitmap should appear to that sector of the control. Control could (even should) have a grid on it. When i have mouse button down, and i move pointer across the surface, more bitmaps should keep appearigng on the grid. Any one have suitable control in mind? 3rd party controls are ok too (if free and open source).
I don't wan't to use any DirectX components or such.
Loading
AnttiPosted Nov 18, 2005, 4:17 AM
sunnyPosted Nov 17, 2005, 4:17 PM
email me a screen shot of ur program, i am not able to understand what you really want. please give a concise description of the form, etc...
AnttiPosted Nov 13, 2005, 3:42 PM
- main panel, which contains all controls of the custom control, because i need automatic scrolling. Control can be resized freely, but the panel is set to maximum size.
- main panel contains the picture boxes
How i can draw the grid over several picture boxes? The pictureboxes draw themselves automatically, even when i override OnPaint method, and added
this.SetStyle(ControlStyles.UserPaint |
ControlStyles.AllPaintingInWmPaint |
ControlStyles.SupportsTransparentBackColor, true);
to the MapControl constructor.
I know i should create Graphics object, but where to create it from? I can't put a panel over the picture boxes, because they need to be clickable. And i tried to put panel over the picture boxes, but i could not make it transparent...
AnttiPosted Nov 13, 2005, 6:13 AM
sunnyPosted Nov 11, 2005, 4:00 PM
So basically you want a grid which is susceptable to clicking and able to display images on the clicked quadrants. Use a picture box control, and replicate it using a for loop, filling the whole Form with picture box controls. Add one picturebox_click event and point all the picture box control's click event to picturebox_click. create a object of picturebox, and you are all set.
ex.
private void picturebox_click(Object sender,System.EventArgs e)
{
PictureBox Pic=(PictureBox)sender;
//now any chanes you make to Pic will directly reflect the changes in sender.
//this will hide the sender.
p.Visible=false;
//this will change sender's backcolor
p.BackColor=Color.Yellow;
//this is remove sender from the from
this.Controls.Remove(p);
//End
}
if you have any questions email me at: [email protected]