Skip to content

XUIColorComponentSlider

Inherits DesktopCanvas

Description

e it in your own projects as a highly customisable slider that represents the component of a colour. although you can us

Properties

Name Type Read-Only
ColorMode XUIColorComponentSlider.ColorModes
CompleteColor Color
ComponentType XUIColorComponentSlider.ComponentTypes
ComponentValue Double
mClickedScrubberOnMouseDown Boolean
mCompleteColor Color
mComponentValue Double
mIsDragging Boolean
mLinearBrush LinearGradientBrush
mMouseDownTicks Double
mMouseDownX Integer
mMouseDownY Integer
mNeedsFullRedraw Boolean
mScrubberBounds Rect
mScrubberColor ColorGroup
mScrubberShadowBrush ShadowBrush
mSliderBorderColor ColorGroup

Methods

Name Parameters Returns
ComponentValueToXCoord graphicsWidth As Double, scrubberDiameter As Double Double
Constructor
UpdateComponentValueFromXCoord x As Integer
UpdateLinearBrush g As Graphics
UpdateLinearBrushCMY startPoint As Point, endPoint As Point
UpdateLinearBrushHSV startPoint As Point, endPoint As Point
UpdateLinearBrushRGB startPoint As Point, endPoint As Point

Events

Name Parameters Returns
FinishedDraggingScrubber
IsDraggingScrubber
PressedSlider newColor As Color

Constants

Name Type
DRAG_THRESHOLD_DISTANCE Double
DRAG_THRESHOLD_TICKS Double

DRAG_THRESHOLD_DISTANCE As Double The number of pixels difference between the current mouse position and the last to trigger a drag operation.


DRAG_THRESHOLD_TICKS As Double The number of ticks that must have elapsed between the last drag operation to trigger another drag.


Enumerations

ColorModes

Determines whether this slider is displaying RGB, CMY or HSV colour information.

Name
RGB
CMY
HSV

ComponentTypes

Represents the various different colour components.

Name
Alpha
Blue
Green
Red
Hue
Saturation
Value
Cyan
Magenta
Yellow

Property Descriptions

ColorMode As XUIColorComponentSlider.ColorModes

The colour mode the slider is currently in.


CompleteColor As Color

The complete colour that this component represents part of.


ComponentType As XUIColorComponentSlider.ComponentTypes

This slider's component type.


ComponentValue As Double

The value of this component.


mClickedScrubberOnMouseDown As Boolean

True if the scrubber was clicked during the last MouseDown event.


mCompleteColor As Color

The complete colour that this component represents part of.


mComponentValue As Double

The value of this component.


mIsDragging As Boolean

True if the scrubber is currently being dragged.


mLinearBrush As LinearGradientBrush

The linear brush to use for the current CompleteColor slider gradient in the Paint event. Computed in UpdateLinearBrush().


mMouseDownTicks As Double

The ticks when the last MouseDown or "actioned" MouseDrag event occurred.


mMouseDownX As Integer

The X coordinate in the last MouseDown event. Set to -1 in the MouseUp event.


mMouseDownY As Integer

The Y coordinate in the last MouseDown event. Set to -1 in the MouseUp event.


mNeedsFullRedraw As Boolean

True if the slider needs a full redraw.


mScrubberBounds As Rect

The bounds of the scrubber, local to this canvas.


mScrubberColor As ColorGroup

The colour of the scrubber.


mScrubberShadowBrush As ShadowBrush

The shadow brush to use when drawing the scrubber.


mSliderBorderColor As ColorGroup

The colour of the slider border.


Method Descriptions

ComponentValueToXCoord(graphicsWidth As Double, scrubberDiameter As Double) As Double

Returns the X coordinate along the slider to use for this slider's current component value.


Constructor()

Default constructor.


UpdateComponentValueFromXCoord(x As Integer)

Sets the component value based on the local X coordinate passed.


UpdateLinearBrush(g As Graphics)

Updates our cached linear brush mLinearBrush for the current CompleteColor depending on the slider's ColorMode.


UpdateLinearBrushCMY(startPoint As Point, endPoint As Point)

Updates our cached linear brush mLinearBrush for the current CompleteColor for CMY component sliders.


UpdateLinearBrushHSV(startPoint As Point, endPoint As Point)

Updates our cached linear brush mLinearBrush for the current CompleteColor for HSV component sliders.


UpdateLinearBrushRGB(startPoint As Point, endPoint As Point)

Updates our cached linear brush mLinearBrush for the current CompleteColor for RGB component sliders.

The gradient runs from &h00 on the left to &hFF on the right of this slider's component type.

For example, if the current colour is &c48ADEF and this is a red component slider then the left hand gradient will be &c00ADEF and the right hand gradient will be &cFFADEF.

So for a red component slider, we vary the red component between &h00 and &hFF but keep the green, blue and alpha components the same.


Event Descriptions

FinishedDraggingScrubber() The scrubber has finished being dragged.


IsDraggingScrubber() The slider's scrubber is being dragged.


PressedSlider(newColor As Color) The user has pressed the slider (not the scrubber), changing its color.