The core of this section is the tool bar section of the Win32 compilation textbook.CodeIs:
Hwintoolbar = creatw.lbarex (hwnd, ws_visible | ws_child | bytes | average, id_toolbar, 0, average, minimum, sttoolbar, num_buttons, sizeof (tbbutton )); nstyle = getwindowlong (hwintoolbar, gwl_style); nstyle & = ~ Tbstyle_transparent; setwindowlong (hwintoolbar, gwl_style, nstyle );
After running, result 1 is shown, that is, the toolbar is filled with the system background color, and the expected effect is figure 2, that is, all the rows in the toolbar are white. As instructed by xingyu, the solution is as follows: add the following line of code:
Nstyle = getwindowlong (hwintoolbar, gwl_style); nstyle & = ~ Tbstyle_transparent; setwindowlong (hwintoolbar, gwl_style, nstyle );
You can.
Cause: In addition to setting the toolbar button as a plane style, the tbstyle_flat style also sets the toolbar as transparent (that is, all the rows in the toolbar are system background colors ). Therefore, you need to remove this transparent property.
Figure 1 plane style but transparent Toolbar
Figure 2 plane style but opacity Toolbar