public static OSMP.Color GetColor() { ColorSelectionDialog colorselectiondialog = new ColorSelectionDialog( "Choose color:" ); ResponseType response = (ResponseType)colorselectiondialog.Run(); //colorselectiondialog. OSMP.Color newcolor = null; if (response == ResponseType.Ok) { LogFile.WriteLine( colorselectiondialog ); LogFile.WriteLine( colorselectiondialog.ColorSelection ); LogFile.WriteLine( colorselectiondialog.ColorSelection.CurrentColor.Red.ToString() + " " + colorselectiondialog.ColorSelection.CurrentColor.Green.ToString() + " " + colorselectiondialog.ColorSelection.CurrentColor.Blue.ToString() ); Gdk.Color newgtkcolor = colorselectiondialog.ColorSelection.CurrentColor; newcolor = new OSMP.Color( newgtkcolor.Red / (double)65536, newgtkcolor.Green / (double)65536, newgtkcolor.Blue / (double)65536 ); } else { LogFile.WriteLine( "cancel pressed" ); } colorselectiondialog.Hide(); return newcolor; }
private void ChangeColorCallback (object o, EventArgs args) { using (ColorSelectionDialog colorSelectionDialog = new ColorSelectionDialog ("Changing color")) { colorSelectionDialog.TransientFor = this; colorSelectionDialog.ColorSelection.PreviousColor = color; colorSelectionDialog.ColorSelection.CurrentColor = color; colorSelectionDialog.ColorSelection.HasPalette = true; if (colorSelectionDialog.Run () == (int) ResponseType.Ok) { Gdk.Color selected = colorSelectionDialog.ColorSelection.CurrentColor; drawingArea.ModifyBg (StateType.Normal, selected); } colorSelectionDialog.Hide (); } }
private void ChangeColorCallback (object o, EventArgs args) { using (ColorSelectionDialog colorSelectionDialog = new ColorSelectionDialog ("Changing color")) { colorSelectionDialog.TransientFor = this; colorSelectionDialog.ColorSelection.SetPreviousRgba (color); colorSelectionDialog.ColorSelection.CurrentRgba = color; colorSelectionDialog.ColorSelection.HasPalette = true; if (colorSelectionDialog.Run () == (int) ResponseType.Ok) { color = colorSelectionDialog.ColorSelection.CurrentRgba; drawingArea.OverrideBackgroundColor (StateFlags.Normal, color); } colorSelectionDialog.Hide (); } }