GH_ColourPickerBase

References
Provides Colour picker GUI not tied to a control-handle.

Constructors

GH_ColourPickerBase

#
public GH_ColourPickerBase()
Create a new instance of the Colour Picker base control. This constructor assigns the default Colour space model and involves a call to the Grasshopper core settings server. You must call SetupColourPicker() prior to rendering this control on screen.

Properties

AutoSize

#
[Category("Display")] public bool AutoSize { get; set; }
Gets or sets a value indicating whether the width and height of the Bounds are adjusted to fit the UI.

BackColour

#
public Color BackColour { get; set; }
Gets or sets the background colour of the picker.

BaseColour

#
[Category("Colours")] public Color BaseColour { get; }
Gets the original base colour for this picker. Use SetupColourPicker to assign this colour.

BaseColourBox

#
[Browsable(false)] public Rectangle BaseColourBox { get; }
Gets the rectangle containing the base colour swatch.

Bounds

#
[Category("Display")] public Rectangle Bounds { get; set; }
Gets or sets the Bounds for this control.

ChannelBox0

#
[Browsable(false)] public Rectangle ChannelBox0 { get; }
Gets the rectangle containing the tag string for the first channel slider.

ChannelBox1

#
[Browsable(false)] public Rectangle ChannelBox1 { get; }
Gets the rectangle containing the tag string for the second channel slider.

ChannelBox2

#
[Browsable(false)] public Rectangle ChannelBox2 { get; }
Gets the rectangle containing the tag string for the third channel slider.

ChannelBox3

#
[Browsable(false)] public Rectangle ChannelBox3 { get; }
Gets the rectangle containing the tag string for the fourth channel slider.

ColourCubeBox

#
[Browsable(false)] public Rectangle ColourCubeBox { get; }
Gets the rectangle that contains the colour space cube.

ColourSpace

#
public GH_ColourSpace ColourSpace { get; }
Gets the Colour space mode used in this picker.

Cube

#
[Browsable(false)] public GH_ColourCube Cube { get; }
Gets the graphics object that describes the current colour cube.

DesiredHeight

#
public int DesiredHeight { get; }
Gets the ideal height for this colour picker given it's width and UI settings.

DrawAlphaSlider

#
[Category("Display")] public bool DrawAlphaSlider { get; set; }
Gets or sets whether or not the alpha slider is included in the UI.

DrawBackground

#
[Category("Display")] public bool DrawBackground { get; set; }
Gets or sets whether the background of the picker is drawn.

DrawChannelSliders

#
[Category("Display")] public bool DrawChannelSliders { get; set; }
Gets or sets whether or not the three basic channel sliders are included in the UI.

DropperPreviewBox

#
public Rectangle DropperPreviewBox { get; }
Gets the rectangle in which the eye-dropped preview will be drawn.

Font

#
public Font Font { get; set; }
Gets or sets the Font used in this Colour Picker. Do not Dispose the Font returned by this property.

HSVSpaceBox

#
[Browsable(false)] public Rectangle HSVSpaceBox { get; }
Gets the rectangle containing the base colour space.

IsTextInput

#
public bool IsTextInput { get; }
Gets whether any of the slider is currently displaying a text input box.

Padding

#
[Category("Display")] public Padding Padding { get; set; }
Gets or sets the Padding for this control.

PickColour

#
[Category("Colours")] public Color PickColour { get; }
Gets the picked colour.

PickColourBox

#
[Browsable(false)] public Rectangle PickColourBox { get; }
Gets the rectangle containing the pick colour swatch.

RGBSpaceBox

#
[Browsable(false)] public Rectangle RGBSpaceBox { get; }
Gets the rectangle containing the pick colour space.

SRCSpaceBox

#
public Rectangle SRCSpaceBox { get; }
Gets the rectangle containing the eye-dropper function.

Methods

Invalidate

#
public void Invalidate()
Raise the Invalidated event.

MouseClick

#
public bool MouseClick(MouseEventArgs args, PointF pt)
Respond to mouse-click events.
args (MouseEventArgs)Mouse Event arguments.
pt (PointF)Mouse cursor position in floating point accuracy.
True if a Drag operation was terminated, false if the event went unnoticed.

MouseDoubleClick

#
public bool MouseDoubleClick(MouseEventArgs args, PointF pt, Control owner, Matrix transform)
Respond to mouse-doubleclick events.
args (MouseEventArgs)Mouse Event arguments.
pt (PointF)Mouse cursor position in floating point accuracy.
owner (Control)Owner control for this colour-picker.
transform (Matrix)Display Transformation matrix of colour-picker.

MouseDown

#
public bool MouseDown(MouseEventArgs args, PointF pt)
Respond to mouse-down events.
args (MouseEventArgs)Mouse Event arguments.
pt (PointF)Mouse cursor position in floating point accuracy.
True if a Drag operation was started, false if the event went unnoticed.

MouseMove

#
public bool MouseMove(MouseEventArgs args, PointF pt)
Respond to mouse-move events.
args (MouseEventArgs)Mouse Event arguments.
pt (PointF)Mouse cursor position in floating point accuracy.
True if a Drag operation was performed, false if the event went unnoticed.

MouseUp

#
public bool MouseUp(MouseEventArgs args, PointF pt)
Respond to mouse-up events.
args (MouseEventArgs)Mouse Event arguments.
pt (PointF)Mouse cursor position in floating point accuracy.
True if a Drag operation was terminated, false if the event went unnoticed.

OnColorChanged

#
public void OnColorChanged(bool intermediate)
Raise the ColorChanged event.
intermediate (bool)Set the intermediate state of the event arguments.

Render

#
public void Render(Graphics G)
Render this slider into a Graphics context.
G (Graphics)Graphics to render with.

RespondToEnter

#
public GH_ToolstripItemKeyHandlerResult RespondToEnter()
RespondToEnter

RespondToEscape

#
public GH_ToolstripItemKeyHandlerResult RespondToEscape()
RespondToEscape

SetUiScaling

#
public void SetUiScaling(float factor)
factor (float)

SetupColourPicker

#
public void SetupColourPicker(Color col0, Color col1, GH_ColourSpace space)
Setup all UI elements.
col0 (Color)Initial colour for this picker.
col1 (Color)Active colour for this picker.
space (GH_ColourSpace)Colour space mode for this picker.

SetupColourPicker

#
public void SetupColourPicker(Color col0, Point4d col1, GH_ColourSpace space)
Setup all UI elements.
col0 (Color)Initial colour for this picker.
col1 (Point4d)Active colour for this picker.
space (GH_ColourSpace)Colour space mode for this picker.

Events

ColorChanged

#
Raised whenever the color of this picker is changed due to User-Interface methods.

Invalidated

#
public event GH_ColourPickerBase.InvalidatedEventHandler Invalidated
Raised whenever a redraw is required.