private void LayerPanel_DoubleClick(object sender, EventArgs e) { // take the focus anyway if we click the panel this.Focus(); // check the type of the layer for option edition if (this.GetType().Name == "LayerGridPanel") { LayerGridOptionForm optionForm = new LayerGridOptionForm(this.mLayerReference as LayerGrid); optionForm.ShowDialog(); } else if (this.GetType().Name == "LayerBrickPanel") { LayerBrickOptionForm optionForm = new LayerBrickOptionForm(this.mLayerReference as LayerBrick); optionForm.ShowDialog(); } else if (this.GetType().Name == "LayerTextPanel") { LayerTextOptionForm optionForm = new LayerTextOptionForm(this.mLayerReference as LayerText); optionForm.ShowDialog(); } else if (this.GetType().Name == "LayerAreaPanel") { LayerAreaOptionForm optionForm = new LayerAreaOptionForm(this.mLayerReference as LayerArea); optionForm.ShowDialog(); } else if (this.GetType().Name == "LayerRulerPanel") { LayerTextOptionForm optionForm = new LayerTextOptionForm(this.mLayerReference as LayerRuler); optionForm.ShowDialog(); } }
private void currentLayerOptionsToolStripMenuItem_Click(object sender, EventArgs e) { // first get the current selected layer Layer selectedLayer = Map.Instance.SelectedLayer; if (selectedLayer != null) { if (selectedLayer is LayerGrid) { LayerGridOptionForm optionForm = new LayerGridOptionForm(selectedLayer as LayerGrid); optionForm.ShowDialog(); } else if (selectedLayer is LayerBrick) { LayerBrickOptionForm optionForm = new LayerBrickOptionForm(selectedLayer); optionForm.ShowDialog(); } else if (selectedLayer is LayerText) { LayerBrickOptionForm optionForm = new LayerBrickOptionForm(selectedLayer); optionForm.ShowDialog(); } else if (selectedLayer is LayerArea) { LayerAreaOptionForm optionForm = new LayerAreaOptionForm(selectedLayer); optionForm.ShowDialog(); } else if (selectedLayer is LayerRuler) { LayerBrickOptionForm optionForm = new LayerBrickOptionForm(selectedLayer); optionForm.ShowDialog(); } } }