Public CC_RGBINIT, CC_FULLOPEN, CC_PREVENTFULLOPEN, CC_SHOWHELP, CC_ENABLEHOOK, CC_ENABLETEMPLATE, CC_ENABLETEMPLATEHANDLE, CC_SOLIDCOLOR, CC_ANYCOLOR If the user attempts to select a non-solid color, convert it to the closest solid color.ĬC_ANYCOLOR = &H100 ' Allow the user to select any color. LpTemplateName As String End Type Private Enum ChooseColorFlagsEnumĬC_RGBINIT = &H1 ' Make the color specified by rgbResult be the initially selected color.ĬC_FULLOPEN = &H2 ' Automatically display the Define Custom Colors half of the dialog box.ĬC_PREVENTFULLOPEN = &H4 ' Disable the button that displays the Define Custom Colors half of the dialog box.ĬC_SHOWHELP = &H8 ' Display the Help button.ĬC_ENABLEHOOK = &H10 ' Use the hook function specified by lpfnHook to process the Choose Color box's messages.ĬC_ENABLETEMPLATE = &H20 ' Use the dialog box template identified by hInstance and lpTemplateName.ĬC_ENABLETEMPLATEHANDLE = &H40 ' Use the preloaded dialog box template identified by hInstance, ignoring lpTemplateName.ĬC_SOLIDCOLOR = &H80 ' Only allow the user to select solid colors. WVK As Integer ' shift, ctrl, menukey, or the key itself.ĭwPadding As Currency ' Not being used. Y As Long End Type Private Type KeyboardInput ' Now, if you'd like to use what's readily available to us in Windows (and follow the standard), here's the code I use to do precisely that (two sections, one for a BAS module, and the other just for some testing in a Form1):Ĭode: Option Explicit Private Type POINTAPI That provides us with our three dimensions (which can be perfectly reworked into RGB if we so desire). And then, we've got a lightness slider off to the far right. Basically, horizontal is hue and vertical is saturation. You'll see the hue and saturation selector (the large colorful palette). Here is a screenshot of the HSL approach provided in Windows (specifically, the right side): And, IMHO, why should we re-invent the wheel when it's all done for us in Windows? And it is precisely this HSL approach that has been adopted by the common dialog of Windows. Basically, it just adds a third selection slider for specifying the lightness factor. In fact, you could use this approach with a reworking of your color wheel, if you expanded it out farther such that the outer edge went all the way to black.īut the HSL approach has become more widely accepted. And here's a typical 2D HSV selection image: The HSV approach truly reduces the problem to two dimensions. The two most widely accepted solutions are referred to as Hue/Saturation/Value (aka, HSV) and Hue/Saturation/Lightness (aka, HSL). However, you are correct that people prefer to see something analogous to your color wheel. Possibly, the simplest is three sliders (black-to-red, black-to-green, & black-to-blue). There have been many attempts at solving this problem. And we're always trying to do it in two dimensions (a computer screen). The basic problem is that color selection is a three dimensional (or three degrees of freedom) problem (Red, Green, & Blue). For instance, how would we select black? Or, for that matter, how would we select any colors that are dark? First, that color wheel you've provided doesn't allow a selection of near anywhere all the possible colors. From my perspective, it seems you need to study a bit about colors and how they work.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |