private IconCheckBox AddOverlayCheckBox() { var check = new IconCheckBox(){Margin = new Padding(3,2,3,2)}; check.CheckedChanged += (sender, args) => ((OverlaySelectionSetting)check.Tag).IsSelected = check.Checked; _overlaysPanel.Controls.Add(check); return check; }
private IconCheckBox AddOverlayCheckBox() { var check = new IconCheckBox() { Margin = new Padding(3, 2, 3, 2) }; check.CheckedChanged += (sender, args) => ((OverlaySelectionSetting)check.Tag).IsSelected = check.Checked; _overlaysPanel.Controls.Add(check); return(check); }
public SelectOverlaysControl(SelectOverlaysAction action, Action close) { InitializeComponent(); SuspendLayout(); _applyToAll.Enabled = action.Enabled; _close.Click += (sender, args) => { action.Apply(); close(); }; _applyToAll.Click += (sender, args) => { action.ApplyEverywhere(); close(); }; foreach (var overlayItem in action.Items) { var item = overlayItem; var check = new IconCheckBox { Checked = overlayItem.IsSelected, CheckEnabled = action.Enabled, Text = item.ResourceResolver.LocalizeString(item.DisplayName) }; if (item.IconSet != null) { var icon = item.IconSet.CreateIcon(IconSize.Small, action.ResourceResolver); check.Image = icon; } check.CheckedChanged += (sender, args) => { item.IsSelected = check.Checked; action.Apply(); }; _overlaysPanel.Controls.Add(check); } ResumeLayout(); }