private void farbeToolStripMenuItem_Click(object sender, EventArgs e) { ColorDialogExtension colorDialog = new ColorDialogExtension(this.Location.X + ((this.Width - 225) / 2), this.Location.Y + ((this.Height - 330) / 2)); colorDialog.Color = Master.Properties.Settings.Default.RasterFarbe; if (colorDialog.ShowDialog() == DialogResult.OK) { Master.Properties.Settings.Default.RasterFarbe = colorDialog.Color; Master.Properties.Settings.Default.Save(); } }
public bool Run(IWindowFrameBackend parent, string title, bool supportsAlpha, Action<Color> colorChangedCallback) { //TODO: Support alpha + create custom WPF solution? dialog = new ColorDialogExtension((int)this.ScreenPosition.X, (int)this.ScreenPosition.Y, title); dialog.Color = System.Drawing.Color.FromArgb((byte)(this.Color.Alpha * 255), (byte)(this.Color.Red * 255), (byte)(this.Color.Green * 255), (byte)(this.Color.Blue * 255)); bool output; if (parent != null) output = (this.dialog.ShowDialog(new WpfWin32Window(((WindowFrameBackend)parent).Window)) == DialogResult.OK); else output = (this.dialog.ShowDialog() == DialogResult.OK); this.Color = Color.FromBytes(this.dialog.Color.R, this.dialog.Color.G, this.dialog.Color.B, this.dialog.Color.A); colorChangedCallback.Invoke(this.Color); this.Close(); return output; }