private void ConfigDialog_Load(object sender, EventArgs e) { brushcollection = new PngBrushCollection(Services, Smudge.RawName); CreateDefaultBrushes(); OnBrushesChanged(); for (int i = 0; i < brushcollection.Count; i++) { brushcombobox.Items.Add(brushcollection[i]); } brushcombobox.Items.Add("Add/Remove Brushes..."); this.BackColor = SystemColors.Control; this.Text = Smudge.StaticDialogName; surface = EffectSourceSurface.Clone(); canvas.Surface = surface; canvas.Selection = Selection; historystack = new HistoryStack(surface, false); InitializeRenderer(); this.DesktopLocation = Owner.PointToScreen(new Point(0, 30)); this.Size = new Size(Owner.ClientSize.Width, Owner.ClientSize.Height - 30); this.WindowState = Owner.WindowState; }
private void OnBrushesChanged() { if (this.InvokeRequired) { Action obcd = OnBrushesChanged; this.Invoke(obcd); } else { brushcollection.Dispose(); brushcollection = new PngBrushCollection(Services, Smudge.RawName); if (brushcollection.Count == 0) { CreateDefaultBrushes(); } object lastsel = brushcombobox.SelectedItem; brushcombobox.Items.Clear(); for (int i = 0; i < brushcollection.Count; i++) { brushcombobox.Items.Add(brushcollection[i]); } brushcombobox.Items.Add("Add/Remove Brushes..."); if (lastsel != null && brushcombobox.Items.Contains(lastsel)) { brushcombobox.SelectedItem = lastsel; } else { brushcombobox.SelectedItem = new PngBrush("Soft Brush"); } } }