[RESOLVED] Add Icon to a Button , keeping the Text
Hi, I've lurked many hours to understand this... but I'm not so good to understand the code of the others..
- I have a button in a dialog application.
- To get some colours, I would like to place an ICON or a BITMAP (as you wish..) on the left of the button, keeping my previous Text (I made text changes to the button during execution... so text is dynamic).
-The Icon/Bitmap must move up and down with the button , better with transparency background color.
I use Visual C++ 6.0 upon Windows Me, so the problem could be this... because code I've tried fail in data exception or something...
Can you post the Best, simple, and easy way to get the Icon/bitmap on the left of a CButton ?
What did fail? Could you showhow you did it and where it "failed"?
Originally Posted by LordHolNapult
Essentially, I dont want to use a foreign class already prepared, I would like to understand what to put in OnInitDialog ....
If you "dont want to use a foreign class already prepared" then you will need to create your own class from the very begin...
However, I recommend you to start with some of already designed class and extend it according your needs. One more example: A Better Bitmap Button Class
Well, thank u for the code. I will study it later.
At the moment I've found a class that does what I've needed... but it's not mine :|
I was suppose not to create a class, but to modify my already defined dialog class to reach my purpose. Anyway, after seeing all the code you and I have found (3 examples tried and 10 i.e.pages readed), I must admit that the task thieves at least 200 lines of code, just to manage the position of the icon and a bit of resize...
I must also admit that no one did as I would like to do, but everyone creates a class and applied a "dodataexchange" that binds between the buttonimage class and the button ID...
Probably you are right (... and me I'm wrong . Class is required, just to add a simple icon to a button....
I quote you. Thanks. But let me say a last thing... Microsoft! Hell fu@&%+**in B@st4%&&&ds!!!
Re: [RESOLVED] Add Icon to a Button , keeping the Text
I want to add an icon with transparent back color to a common radio button with push-like property, CButton class. Just this! I don't want complex derived classes to redraw a all control, I search in MSDN an many places more, but I don't know how to do it.
Please, may you help me to find this 5 lines of code that do it?