PDA

View Full Version : Color Picker Wheel



JosephE
13-11-2010, 02:56
Here's a custom color picker control I've been working on lately.

It uses HSV to RGB conversion, as well as some trigonometry I've been learning lately to calculate angles and the like. It calculates the color based on math, so colors that are picked out are exact, rather than being dependent on the user's display.

Let me know what you think! Improvements and suggestions are welcome.

ErosOlmi
13-11-2010, 09:04
Great, great.

The only improvement I can think is to add few textbox at the bottom where to report rgb color in various ways avoiding msgbox and allowing user to copy rgb color from there.

Examples for textbox
human (decimal): r, g, b
Web hex form: #XXYYZZ
...

Thanks a lot
Eros

Petr Schreiber
13-11-2010, 10:43
Very nice,

I think it is the first time I see something like "custom control" in ThinBASIC.
Good job!


Petr

Michael Hartlef
13-11-2010, 15:08
Cool. Like Eros said, add the color values as text there.

JosephE
13-11-2010, 20:13
Thanks guys. The wonderful canvas support in thinBASIC makes it trivial to make "custom controls" like this (and I'm sure it would be possible to make even more advanced drawings with GDI commands on the canvas's device context).

I wanted the developer to be able to make multiple instances of these controls, which is why I implemented the control as a UDT. I'm not very familiar how thinBASIC handles controls, so I didn't bother dynamically making textbox controls and callbacks...I assume the person implementing this control would link their textboxes to it by updating them when the control is updated in the WM_LBUTTONDOWN and WM_MOUSEMOVE sections (which is what I plan to do when I use it for a drawing program [if I get around to it]).