private void btnAddLayer_Click(object sender, EventArgs e) { string layerName; int layerWidth; int layerHeight; TileLayer layer; LayerForm Form = new LayerForm(LayerList.Items.Count); Form.ShowDialog(); if (Form.OkPressed) { layerName = Form.txtLayerName.Text; layerWidth = int.Parse(Form.txtLayrWidth.Text); layerHeight = int.Parse(Form.txtLayHeight.Text); layer = new TileLayer(layerWidth, layerHeight); dictLayer.Add(layerName, layer); LayerList.Items.Add(layerName); Map.Addlayer(layer); currentLayer = layer; foreach (string s in TextureList.Items) { currentLayer.AddTexture(dictTextures[s]); } LayerList.SetSelected(LayerList.Items.Count - 1, true); } }