private void btDown_Click(object Sender, System.EventArgs E) { if (selectedLayerControl != null) { int currentIndex = flpLayers.Controls.GetChildIndex(selectedLayerControl); if (currentIndex < flpLayers.Controls.Count - 1) { int targetIndex = currentIndex + 1; LayerControl targetControl = (LayerControl)flpLayers.Controls[targetIndex]; flpLayers.Controls.SetChildIndex(targetControl, currentIndex); flpLayers.Controls.SetChildIndex(selectedLayerControl, targetIndex); LayerIndexChanged?.Invoke(selectedLayerControl.LayerName, flpLayers.Controls.IndexOf(selectedLayerControl)); } } }
private void btDel_Click(object Sender, System.EventArgs E) { if (selectedLayerControl == null) { return; } LayerRemoved?.Invoke(selectedLayerControl); int layerIndex = flpLayers.Controls.IndexOf(selectedLayerControl); flpLayers.Height -= selectedLayerControl.Height + 6; flpLayers.Controls.Remove(selectedLayerControl); int currentIndex = 0; foreach (LayerControl lc in flpLayers.Controls) { if (layerIndex <= currentIndex) { LayerIndexChanged?.Invoke(lc.LayerName, currentIndex); } currentIndex++; } selectedLayerControl = null; Refresh(); }
private void LayerStackConfigControl_LayerIndexChanged(string LayerName, int LayerIndex) { LayerIndexChanged?.Invoke(LayerName, LayerIndex); }