| |

VerySource

 Forgot password?
 Register
Search
View: 711|Reply: 4

Question about colored toolbars. anxious! !! !!

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-3-3 22:00:02
| Show all posts |Read mode
The method I used was CToolBar :: SetImageList (), and the setting was successful! But if I disable the buttons on the toolbar, the place where the true color buttons are displayed becomes dark and I can't see anything.
Reply

Use magic Report

0

Threads

8

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-5-22 18:15:01
| Show all posts
No message mapping is added, the button is disabled
Reply

Use magic Report

0

Threads

5

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-5-25 20:15:01
| Show all posts
use
GetSystemMenu (TRUE);
DrawMenuBar ();

Give it a try
Reply

Use magic Report

0

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-6-28 11:30:01
| Show all posts
CToolBar::SetImageList() has several similar methods
SetHotImageList() // The picture displayed when the mouse is moved over the button
SetDisabledImageList(&img)//When the button is disabled, display
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-7-13 18:45:01
| Show all posts
Which is because the "Disable" bitmap is not set, and MFC uses the default algorithm to transform the "normal" bitmap, but this is very ugly for the true color toolbar.

So it is best to use code to set, use SetDisabledImageList () function, the picture can be obtained by the following simple methods:
Use PhotoShop to open the drawn menu bar menu image, select: Image->Mode->Grayscale, and then save it as a file for SetDisabledImageList!

Sample code:
CImageList img;
CBitmap bitmap;
The
// Set the minimum and maximum size of the button and support the extended button style
m_wndOftenToolBar.GetToolBarCtrl().SetButtonWidth(32, 42);
m_wndOftenToolBar.GetToolBarCtrl().SetExtendedStyle(TBSTYLE_EX_DRAWDDARROWS);
The
// Bitmap setting button "hot"
bitmap.LoadBitmap(IDB_HOTTOOLBAR);
img.Create(32, 31, ILC_COLOR8 | ILC_MASK, 0, 0);
img.Add(&bitmap, RGB(192,192,192));
m_wndOftenToolBar.GetToolBarCtrl().SetHotImageList(&img);
bitmap.Detach();
img.Detach();
The
// Bitmap setting button "cold"
bitmap.LoadBitmap(IDB_COLDTOOLBAR);
img.Create(32, 31, ILC_COLOR8 | ILC_MASK, 0, 0);
img.Add(&bitmap, RGB(192,192,192));
m_wndOftenToolBar.GetToolBarCtrl().SetImageList(&img);
bitmap.Detach();
img.Detach();
The
// Set the bitmap of the button "Disable"
bitmap.LoadBitmap(IDB_DISABLETOOLBAR);
img.Create(32, 31, ILC_COLOR8 | ILC_MASK, 0, 0);
img.Add(&bitmap, RGB(192,192,192));
m_wndOftenToolBar.GetToolBarCtrl().SetDisabledImageList(&img);
bitmap.Detach();
img.Detach();
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