How many color in a bitmap?

I just want to know how many color are
in a picturebox and what are the RGB values ?

Thanks a lot.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


The answer is wrong. It depends on your display setup.
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

dhametAuthor Commented:
OK, first of all, I'm french so...
Be gentle with my english...
Let's try to be clear :
For exemple I have a bitmap with only 11
colors used in, I would like to know the
RGB values for these 11 colors.
I'm quite sure the only way - to be fast - is to read
(something, somewhere?) in the bitmap

My purpose is to play with Hue, Saturity and Luminosity (HSL) with each color of the bitmap.
For exemple, creating an ActiveX button
which have the capicity to be highlited when you move on (by playing with brightness).
If you have an answer and if you are interested, I can send you a very good beginning of this (little) ActiveX project.
Hm.. that requires API calls, I think.

Maybe someone like waty might know the answer. Otherwise (dare I say) it might by an idea to check the VB API section in
You can see how many colors are in a *bitmap* file by using my free mmInfo.exe program at the link below(comes with full VB source).

As was mentioned previously, the color depth of the picture control hDC is the same as the current display color depth.  So if you do a SavePicture on a picture box the bit depth of the resulting file will depend on your current graphics adaptor settings.

Hope this helps,
Ray Mercer
MS-MVP Visual Basic

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Nice bit of code!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.