/// <summary> /// flowLayoutPanelEx 选择发生变化通知 【示例】 /// </summary> void Event_FlowControl(FlowCellUserControl uc) { if (uc.CellPreset.Brush is SolidBrush) { solidUserControl1.color = ((SolidBrush)uc.CellPreset.Brush).Color; } else if (uc.CellPreset.Brush is LinearGradientBrush) { // _EanbleNotify = false; linearGradientUserControl1.LinearGradientBrushInfo = new NSLinearGradientBrushInfo(((LinearGradientBrush)uc.CellPreset.Brush).InterpolationColors, uc.CellPreset.Angle); Event_LinearBrushControl(((LinearGradientBrush)uc.CellPreset.Brush).InterpolationColors, uc.CellPreset.Angle); _EanbleNotify = true; } else if (uc.CellPreset.Brush is HatchBrush) { HatchBrush hb = ((HatchBrush)uc.CellPreset.Brush); if (_hatchBrushExample != null) { _hatchBrushExample.Dispose(); } hatchBrushInfo.Style = hb.HatchStyle; _hatchBrushExample = new HatchBrush(hatchBrushInfo.Style, hatchBrushInfo.ForeColor, hatchBrushInfo.BackColor); Notify(); } else if (uc.CellPreset.Brush is PathGradientBrush) { // _EanbleNotify = false; linearGradientUserControl2.LinearGradientBrushInfo = new NSLinearGradientBrushInfo(((PathGradientBrush)uc.CellPreset.Brush).InterpolationColors, 0); Event_PathBrushControl(((PathGradientBrush)uc.CellPreset.Brush).InterpolationColors, 0); // _EanbleNotify = true; } }
public void Add(FlowCell cell) { list.Add(cell);//添加到链表 FlowCellUserControl CellUserControl = new FlowCellUserControl(cell); CellUserControl.Length = CellLength; CellUserControl.EventSelectTrue = CellPresetUserControl_SelectedTrue; CellUserControl.EventMenuDelete = CellPresetUserControl_MenuDelete; Controls.Add(CellUserControl); }
void CellPresetUserControl_SelectedTrue(FlowCellUserControl cellUC) { foreach (UserControl userControl in Controls) { if (userControl is FlowCellUserControl && userControl != cellUC) { ((FlowCellUserControl)userControl)._Selected = false; ((FlowCellUserControl)userControl).Invalidate(); } } if (EventSelectedChange != null) { EventSelectedChange(cellUC); } }
void UpdateData(bool ToControl) { if (ToControl) { Controls.Clear(); for (int i = 0; i < list.Count; i++) { FlowCell cell = list[i]; FlowCellUserControl CellUserControl = new FlowCellUserControl(cell); CellUserControl.Length = CellLength; CellUserControl.EventSelectTrue = CellPresetUserControl_SelectedTrue; CellUserControl.EventMenuDelete = CellPresetUserControl_MenuDelete; Controls.Add(CellUserControl); } } else { //... } }
void CellPresetUserControl_MenuDelete(FlowCellUserControl cellUC) { list.Remove(cellUC.CellPreset); Controls.Remove(cellUC); }