Replace the Color Picking Dialog

Demonstrates how to replace Rhino's color picking dialog.

partial class Examples
{
  private static ColorDialog m_dlg = null;

  public static Result ReplaceColorDialog(RhinoDoc doc)
  {
    Dialogs.SetCustomColorDialog(OnSetCustomColorDialog);
    return Result.Success;
  }

  static void OnSetCustomColorDialog(object sender, GetColorEventArgs e)
  {
    m_dlg = new ColorDialog();
    if (m_dlg.ShowDialog(null) == DialogResult.Ok)
    {
      var c = m_dlg.Color;
      e.SelectedColor = System.Drawing.Color.FromArgb (c.Ab, c.Rb, c.Gb, c.Bb);
    }
  }
}
Partial Friend Class Examples
  Private Shared m_dlg As ColorDialog = Nothing

  Public Shared Function ReplaceColorDialog(ByVal doc As RhinoDoc) As Result
	Dialogs.SetCustomColorDialog(AddressOf OnSetCustomColorDialog)
	Return Result.Success
  End Function

  Private Shared Sub OnSetCustomColorDialog(ByVal sender As Object, ByVal e As GetColorEventArgs)
	m_dlg = New ColorDialog()
	If m_dlg.ShowDialog(Nothing) = DialogResult.Ok Then
	  Dim c = m_dlg.Color
	  e.SelectedColor = System.Drawing.Color.FromArgb(c.Ab, c.Rb, c.Gb, c.Bb)
	End If
  End Sub
End Class
# No Python sample available