RhinoCommon API
DialogsSetCustomColorDialog Method |
[Missing <summary> documentation for "M:Rhino.UI.Dialogs.SetCustomColorDialog(System.EventHandler{Rhino.UI.GetColorEventArgs})"]
Namespace: Rhino.UI
Assembly: RhinoCommon (in RhinoCommon.dll)

public static void SetCustomColorDialog( EventHandler<GetColorEventArgs> handler )
Public Shared Sub SetCustomColorDialog ( handler As EventHandler(Of GetColorEventArgs) )
Parameters
- handler
- Type: SystemEventHandlerGetColorEventArgs
[Missing <param name="handler"/> documentation for "M:Rhino.UI.Dialogs.SetCustomColorDialog(System.EventHandler{Rhino.UI.GetColorEventArgs})"]

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; } } } }
Imports Rhino Imports Rhino.Commands Imports Rhino.UI Imports System.Windows.Forms Namespace examples_vb Public Class ReplaceColorDialogCommand Inherits Command Public Overrides ReadOnly Property EnglishName() As String Get Return "vbReplaceColorDialog" End Get End Property Private m_dlg As ColorDialog = Nothing Protected Overrides Function RunCommand(doc As RhinoDoc, mode As RunMode) As Result Dialogs.SetCustomColorDialog(AddressOf OnSetCustomColorDialog) Return Result.Success End Function Private Sub OnSetCustomColorDialog(sender As Object, e As GetColorEventArgs) m_dlg = New ColorDialog() If m_dlg.ShowDialog(Nothing) = DialogResult.OK Then Dim c = m_dlg.Color e.SelectedColor = c End If End Sub End Class End Namespace
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()

Rhino for Mac
Supported in: 5.4Rhino for Windows
Supported in: 6.8