public override void Run(string[] parameters) { string result = ""; using (var form = new Cyotek.Windows.Forms.ColorPickerDialog() { StartPosition = FormStartPosition.Manual, TopMost = true }) { form.SetDesktopLocation(Cursor.Position.X - 20, Cursor.Position.Y - 20); var dialogResult = form.ShowDialog(); if (dialogResult == DialogResult.OK) { Color c = form.Color; if (c.A == 255) { result = "#" + c.R.ToString("X2") + c.G.ToString("X2") + c.B.ToString("X2"); } else { result = "#" + c.R.ToString("X2") + c.G.ToString("X2") + c.B.ToString("X2") + c.A.ToString("X2"); } } } InputSimulator.SimulateTextEntry(result); }
private void pictureBoxEndColor_Click(object sender, EventArgs e) { var dialog = new ColorPickerDialog(); dialog.Color = EndColor; if (dialog.ShowDialog() == DialogResult.OK) { EndColor = dialog.Color; } }
private void btn_BackgroundColor_Click(object sender, EventArgs e) { ColorPickerDialog colorDialog = new ColorPickerDialog(); DialogResult result = colorDialog.ShowDialog(); switch (result) { case DialogResult.OK: Game.BackgroundColor = GameGraphics.ConvertSystemColorToXNA(colorDialog.Color); return; default: return; } }
protected virtual void EditColor(int colorIndex) { using (ColorPickerDialog dialog = new ColorPickerDialog()) { dialog.Color = this.GetColor(colorIndex); if (dialog.ShowDialog(this) == DialogResult.OK) { this.BeginUpdate(); this.SetColor(colorIndex, dialog.Color); this.Color = dialog.Color; this.EndUpdate(); } } }
protected virtual void EditColor(int colorIndex) { using (var dialog = new ColorPickerDialog()) { dialog.Color = GetColor(colorIndex); if (dialog.ShowDialog(this) == DialogResult.OK) { BeginUpdate(); SetColor(colorIndex, dialog.Color); Color = dialog.Color; EndUpdate(); } } }
public override object EditValue( ITypeDescriptorContext context, IServiceProvider provider, object value) { // Attempts to obtain an IWindowsFormsEditorService. IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (edSvc == null) { return null; } // Displays a StringInputDialog Form to get a user-adjustable // string value. using (ColorPickerDialog dialog = new ColorPickerDialog()) { dialog.Color = (Color) value; if (edSvc.ShowDialog(dialog) == DialogResult.OK) { return dialog.Color; } } // If OK was not pressed, return the original value return (Color)value; }
private void colorSwatchBackgroundColor_Click(object sender, EventArgs e) { var dialog = new ColorPickerDialog(); dialog.Color = colorSwatchBackgroundColor.SelectedColor; if (dialog.ShowDialog() == DialogResult.OK) { colorSwatchBackgroundColor.SelectedColor = dialog.Color; if(BackgroundColorChanged != null) BackgroundColorChanged(sender, new BackgroundColorChangedEventArgs(dialog.Color)); } }
//Frame color button click private void btn_FrameColor_Click(object sender, EventArgs e) { ColorPickerDialog colorDialog = new ColorPickerDialog(); DialogResult result = colorDialog.ShowDialog(); switch (result) { case DialogResult.OK: ColorAction action = new ColorAction { Name = "Frame color", Drawable = FrameRectangleName, Value = GameGraphics.ConvertSystemColorToXNA(colorDialog.Color) }; textureManager.ExecuteAction(action); _textureGame.RunOneFrame(); return; default: return; } }
private void btn_TransparentColor_Click(object sender, EventArgs e) { ColorPickerDialog colorDialog = new ColorPickerDialog(); DialogResult result = colorDialog.ShowDialog(); switch (result) { case DialogResult.OK: Texture2D newTexture = BinaryTexture.RemoveTransparentColor(selectedTexture, GameGraphics.ConvertSystemColorToXNA(colorDialog.Color)); Game.gameGraphics.textureManager.Textures[newTexture.Name] = newTexture; selectedTexture = newTexture; return; default: return; } }