Click or drag to resize

DialogsSetCustomColorDialog Method

[Missing <summary> documentation for "M:Rhino.UI.Dialogs.SetCustomColorDialog(System.EventHandler{Rhino.UI.GetColorEventArgs})"]

Namespace:  Rhino.UI
Assembly:  RhinoCommon (in RhinoCommon.dll)
Since: 5.0
Syntax
public static void SetCustomColorDialog(
	EventHandler<GetColorEventArgs> handler
)

Parameters

handler
Type: SystemEventHandlerGetColorEventArgs

[Missing <param name="handler"/> documentation for "M:Rhino.UI.Dialogs.SetCustomColorDialog(System.EventHandler{Rhino.UI.GetColorEventArgs})"]

Examples
using Rhino;
using Rhino.Commands;
using Rhino.UI;
using System.Windows.Forms;

namespace examples_cs
{
  public class ReplaceColorDialogCommand : Command
  {
    public override string EnglishName { get { return "csReplaceColorDialog"; } }

    private ColorDialog m_dlg = null;

    protected override Result RunCommand(RhinoDoc doc, RunMode mode)
    {
      Dialogs.SetCustomColorDialog(OnSetCustomColorDialog);
      return Result.Success;
    }

    void OnSetCustomColorDialog(object sender, GetColorEventArgs e)
    {
      m_dlg = new ColorDialog();
      if (m_dlg.ShowDialog(null) == DialogResult.OK)
      {
        var c = m_dlg.Color;
        e.SelectedColor = c;
      }
    }
  }
}
Python
from Rhino import *
from Rhino.Commands import *
from Rhino.UI import *
from System.Windows.Forms import *

m_dlg = None

def RunCommand():
  Dialogs.SetCustomColorDialog(OnSetCustomColorDialog)
  return Result.Success

def OnSetCustomColorDialog(sender, e):
  m_dlg = ColorDialog()
  if m_dlg.ShowDialog(None) == DialogResult.OK:
    c = m_dlg.Color
    e.SelectedColor = c

if __name__ == "__main__":
  RunCommand()
See Also