I use standard Toolbar class. I changed its Win7 theme to empty theme, it looks like plain greyed colored. How I can change its gray BG color to other? To e.g. dark blue, or brown? I want to colorize it.
Use the TBSTYLE_CUSTOMERASE style on the control:
TBSTYLE_CUSTOMERASE
Version 4.70. Generates NM_CUSTOMDRAW notification
codes when the toolbar processes WM_ERASEBKGND messages.
Then you handle the NM_CUSTOMDRAW notification and when you get the CDDS_PREERASE event, draw your own background and return CDRF_SKIPDEFAULT.
Related
I need to set the background color of a window sizing gripper control, which we're doing with:
DrawFrameControl(hdc, &rect, DFC_SCROLL, DFCS_SCROLLSIZEGRIP);
It doesn't appear to get any of the WM_CTLCOLOR* messages. I tried filling the window in WM_ERASEBKGND and returning TRUE, but that doesn't work.
I can paint it myself, but it seems like this would be unnecessary to just change the BG color.
Any ideas?
I want to change the color of the title bar of a dialog box. I know there is WM_NCPAINT which is used to paint the non client area. But I don't find a good example of WM_PAINT where the color is changed to a specific color.
I tried SetMenuInfo with MIM_BACKGROUND, but it doesn't work. I found it is because the Visual Style is enabled. But I don't want to disable the Visual Style by SetWindowTheme(hwndMain, L"", L"") becauuse it will change the appearance of the title bar and border...etc.
Is there any way to change, and only change the background color of the menu bar, without disalbe Visual Style of the main window. By "only change", I also mean that I don't have to draw the menu items myself, like I can use custom draw for change only the background color of toolbar, tab...etc. (But I can find custom draw for menu bar!).
You just set MainMenu's OwnerDraw Property to true, and Menu is automatically close Menu's theme, but don't close Window's theme!
With themes there is no official way to change the color. However you can take advantage of some undocumented window messages to implement the custom drawing yourself. https://github.com/adzm/win32-custom-menubar-aero-theme
In a standard Cocoa window, is it possible to change the colors of the close, minimize, and resize window buttons from the textured, glossy, gumdrop style to a simple red, yellow, and green color with no gradient/gloss?
There's no built-in way so you've gotta do your own custom drawing.
Check out How to draw custom window controls (close, minimize, and zoom buttons) for an example.
No. But you can create a custom borderless window and create buttons if your liking and connect them to the same actions.
I have an MFC dialog (actual a dialog bar with in a dialog) that contains a progress bar with these strange black pixels in the corner. I have tried the following to remove them:
Change most of the border type styles and the transparent style of the control.
Override the OnEraseBkgnd in a class derived a CProgressCtrl.
Setting the background color of the control by PBM_SETBKCOLOR.
I have yet to find a way to remove these black pixel.
Here is an example of what it looks like:
It seems I have found the issue. When the progress bar performs its painting it was sending an WM_ERASEBKGND message to the dialog to get the background with which it would paint. Some how the DC brush origin was being messed up. Using the following code at the start of the function seems to have fixed the issue with no ill effects.
CRect rcClip;
pDC->GetClipBox(rcClip);
pDC->SetBrushOrg(-rcClip.left, -rcClip.top);
I've seen this occur when using ActiveX controls inside control containers that don't have a a window or proper Device Contexts (The VB6 frame control is one of these) but I'm not sure if the same problem applies to MFC windows and controls though.
Try making the control parent a normal static window.