| |

VerySource

 Forgot password?
 Register
Search
View: 763|Reply: 5

About toolbars and CButtons

[Copy link]

3

Threads

8

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-1-11 00:00:01
| Show all posts |Read mode
I want to add a self-drawn button to the toolbar instead of its default button. What should I do?
I have defined Button in the derived class of the toolbar as follows:
Cbutton mybutton
Then I added it to the form's OnCreate
m_wndToolBar.mybutton.Create (_T (""), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, rect,&m_wndToolBar, IDC_COLORSELE);
When running in this way, I get an unavailable button on the toolbar, which is depressed.
Even more annoying is if you add
BS_OWNERDRAW style will still fail, what should I do?
Reply

Use magic Report

0

Threads

59

Posts

43.00

Credits

Newbie

Rank: 1

Credits
43.00

 China

Post time: 2020-1-14 13:45:01
| Show all posts
With the BS_OWNERDRAW style, you must cover the CWnd :: DrawItem virtual function, otherwise it will report an error!
Reply

Use magic Report

3

Threads

8

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

 Author| Post time: 2020-1-14 15:00:02
| Show all posts
The resulting button is unavailable, why? How to enable it?
Reply

Use magic Report

0

Threads

59

Posts

43.00

Credits

Newbie

Rank: 1

Credits
43.00

 China

Post time: 2020-1-14 15:45:01
| Show all posts
Add button message mapping
Reply

Use magic Report

3

Threads

8

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

 Author| Post time: 2020-1-14 16:00:01
| Show all posts
Yeah, thank you.
Reply

Use magic Report

0

Threads

6

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 Invalid IP Address

Post time: 2020-3-13 17:30:02
| Show all posts
Not available, no message mapping!
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list