Click here to Skip to main content
15,907,687 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I want to create a toolbar like color picker tool in paint window 7, But i dont know how to draw image (at least a fill rect shape) on button?

You can see how button Color 1 and Color 2 in paint window 7 working, i have a solution to imitate it, i use SetImageIndex() to change button image, it work like paint program, but it just work perfectly if we have limit color to create a bitmap, with custom color case (at this time color user can choose will be up to 65k color, if we create image to store, we must create 65k image T_T) so i cant use this solution for this case.

I see that there is DrawImage() method in CMFCRibbonButton class, but i dont know how to use(cant find an example)

If anyone have a idea about creating that color picker or how to draw image, pls let me know.
Thank you in advance!
Posted
Updated 28-Sep-21 16:50pm

( I don't have Windows 7)

Aren't you supposed to use a CMFCRibbonColorButton[^] to implement that feature ?
 
Share this answer
 
How about updating the image itself? So when the color changes you update parts of the image with the new color as needed and then make the button redraw itself.
 
Share this answer
 
Thank for replying!

I know about CMFCRibbonGalleryButton, but this wont be what i want. If we use update image, so how many images i will prepare to change image (65,000+ color = 65,000+ images, OMG!)

I have new solution, i will create new class derive from CMFCRibbonButton, then i'll override OnDraw or DrawImage method. I'll update my approach later.

In mean time, i appreciate any ideas

Thank you for reading and suggesting idea
 
Share this answer
 
I have new solution, i will create new class derive from CMFCRibbonButton, then i'll override OnDraw or DrawImage method. I'll update my approach later.


Is there any update about this?
 
Share this answer
 
Comments
Richard Deeming 29-Sep-21 4:01am    
If you want to ask for more information, click the "Have a Question or Comment?" button under the relevant solution and post a comment.

Do not post your comment as a "solution" to the question.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900