Is there a colour pciker control in VB?
Need the output like FF00FF
Thank You
ILMV
Printable View
Is there a colour pciker control in VB?
Need the output like FF00FF
Thank You
ILMV
you can use the commondialog control to open a palette of colours
I need to convert the code value from the colour dialog box, from 65280 (or whatever it might be) to VB hex like... &H00FFFFFF&
You could simply use the Hex function. However Windows store the colors in this format: BBGGRR while you probably want them outputted as RRGGBB right?
Im not sure, you know the codes used in VB like &H00FFFFFF&
That is the code for white. but i dont know what parts are for red, green and blue!?
As I said the format Windows is using is BBGGRR.
I know that the colour format it BGR, blue greed red.
how do i use the HEX function, with example if possible.
I have written a component called RGBMixer that can do what you need. It shows a dialog box in which the user can select from 3 different palettes to select a color from. They can also mix the color together from the three sliders that represent the RGB colors. See the screen shot.
Here's an example how you use it.The CRGBMixer class has 4 properties and 1 method. The properties are:VB Code:
Dim color As RGBMixer.CRGBMixer Set color = New RGBMixer.CRGBMixer With color .Palette = eWebSafe .Format = eVBHex If .ShowDialog = eOK Then MsgBox "The select format for the color value " & .color & _ " is " & .Value End If End With
- Color - The selected color in decimal format. (Read-Only)
- Format - The format the user has selected. There are 11 different formats to pick from.
- Palette - The palette that should be shown by default.
- Value - String value that represents the selected color in the selected format (Read-Only).
The only method is ShowDialog that returns either eOK or eCancel depending on which button the user has clicked in the dialog box.
http://www.vbforums.com/attachment.p...chmentid=38912
Cheers joacim.
Will check it out
Try this as well, assuming you have an image in a Picturebox.
VB Code:
Option Explicit Private Declare Function GetPixel Lib "gdi32" (ByVal hDC As Long, ByVal X As Long, ByVal Y As Long) As Long Private Color As Long Private Hex_Color As String Private Sub Form_Activate() Picture1.ScaleMode = 3 'Required for GetPixel to work. End Sub Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Color = GetPixel(Picture1.hDC, X, Y) Hex_Color = Hex(Color) Label1.Caption = Color Label2.Caption = Hex_Color End Sub
Could someone explain to me why Windows is stupid and uses BGR when everything else uses RGB?Quote:
Originally Posted by Joacim Andersson
It's not so much that Windows is stupid but that the Intel processor architecture use little endian by default. This means that the low-order byte is stored in the memory with the lowest address.
DirectX is BGR based too :)
Well, DirectX is made for Windows so that doesn't surprise me. However some applications and file format might use big endian even if they exist for Windows.
Photoshop for example is big endian, but then again Photoshop was first developed for Mac which use Motorola processors which use big endian. BMP and GIF are little endians so both these image formats store color information in BGR format in memory. JPEG on the other hand is big endian. Other image formats that use little endians are PCX and TGA.
Some image formats like for example TIFF and XWD use both little and big endians. They then have identifiers encoded into the file which specify which of the formats that is used.
WPG (WordPerfect Graphics Metafiles) are big endians even though WordPerfect was first written for PC's.
Uhhh?
What is big/little edian?
If you only said this in the CC section :lol:Quote:
Originally Posted by eyeRmonkey
I believe that would be the High Integer and Low Integer values of something. It's also used in the QueryPerformanceCounter and QueryPerformanceFrequency API's
And what would your CC response be? Use that lame "best programmer" thread to respond. ;)
Explanation of Big Endian and Little Endian Architecture .Quote:
Originally Posted by eyeRmonkey
Big endian is the red end of a baboon :)
I hope you like bananas :bigyello:Quote:
Originally Posted by eyeRmonkey