I have created a simple MFC MDI doc/view application with a status bar. The font in the status bar is too small for my taste, so I'd like to make the status bar taller, and use a larger font in the status bar. I cannot figure out how to do either of these.
There is a virtual function CMFCStatusBar::CalcFixedLayout(BOOL, BOOL bHorz) which (I think) uses the status bar's current font to set the bar height, so maybe all that needs to be done is change the font. How can I do this?
64-bit Windows 7, Visual Studio 2010, native C++
Related
My standard win32 program overrides WM_CTLCOLORDLG to offer "dark mode" dialogs, returning a brush according to the documentation. The code works fine for all windows from 98 to 10.
For windows 11, although plain dialogs show with a dark background without problem, those inside a property sheet (again standard using PropertySheet API) don't paint correctly, as in this picture
notice that individual controls in the page paint correct dark backgrounds, but the property page dialog doesn't
The WM_CTLCOLORDLG handler is called, but the returned background brush is ignored in this case. Has anyone tried "custom" property pages in windows 11?
I am creating a MFC CDialog and adding a bitmap in a picture control and I have edit controls that need to be placed relative to positions on the image. However the size of the image in the picture control changes when I run my application.
This makes it difficult to align my edit boxes with the image.
Can anybody tell me why this happens?
There is no code to post as this is entirely done in the dialog editor of VS2013.
Windows adjusts the size of dialogs to match the system font, which can be changed by the user. For information about this look up dialog base units. If you need your dialog layout to match a bitmap then you need to override the Windows adjustment and explicitly set the size and location of the controls at run time. That would mean that in OnInitDialog you use MoveWindow on the dialog itself and on every control to set their size and location in pixel units that match the bitmap.
I have a UI C++ Win32/WTL app. I have an application icon with many embedded sizes, including 16x16, 32x32, 48x48 and 64x64. I do a SetIcon() for both small and large icons and yet my Windows 7 task bar shows a blurry scaled up icon.
Are there any special APIs that need to be called or some special considerations?
The icon shown in the taskbar is not the one you set with SetIcon() but the one that explorer also shows for the exe file itself. That means it shows the very first icon in your exe resources.
Change the resource ID of your icon to e.g. 1 so it's the first icon, or add other sizes to the first icon your exe currently uses.
Icons are in the order? I have information, that Windows use icons in direct order. Try place icon 64x64 in the first place in array.
Unusual DPI / font size setting? I've seen XP ask for a 20x20 icon.
I am using Qt, what I want to do is to display custom popup over the icon in system tray in Windows. I can obtain icon coordinates by using geometry() and taskbar height by finding difference between screenGeometry() and availableGeometry(). So the popup can be alligned correctly and does not overlap taskbar for different taskbar orientations (e.g. when taskbar is on the left side or on the top of the screen).
The problem starts when autohide of taskbar is turned on, then apparently availableGeometry returns the same value as screenGeometry, and I cannot find the taskbar height anymore. This results in the popup overlapping with taskbar, or even displayed at the wrong location.
My question is: how can I detect correctly orientation and size of taskbar in Windows, when the autohide is enabled? Should I use some winapi function, or can I do it purely in Qt (preferable) ?
1) Autohide state you check using this: http://msdn.microsoft.com/en-us/library/bb787947(v=vs.85).aspx
2) And find width/height/orientation using this: http://msdn.microsoft.com/en-us/library/bb787953(v=vs.85).aspx
Hope this helps. Yes, this is WinAPI functions, so you should use this code in "#ifdef Q_OS_WINDOWS" only - if want to compile on Linux too.
When using the CreateSimpleReBar in WTL the main menu bar has this blue color on mouse hover and not the native vista/7 round and transparent shape. Also for some reason the menu bar seems taller then the usual native one.
Does CreateSimpleReBar draw the menu itself or am I missing something?
http://imageshack.us/photo/my-images/259/wtlmainmenu.png/
HWND hWndCmdBar = m_CmdBar.Create(m_hWnd, rcDefault, NULL, ATL_SIMPLE_CMDBAR_PANE_STYLE);
// attach menu
m_CmdBar.AttachMenu(GetMenu());
// load command bar images
m_CmdBar.LoadImages(IDR_MAINFRAME);
// remove old menu
SetMenu(NULL);
// Set m_hWndToolBar member
CreateSimpleReBar(ATL_SIMPLE_REBAR_NOBORDER_STYLE);
// Add a band to the rebar represented by m_hWndToolBar
AddSimpleReBarBand(hWndCmdBar);
CreateSimpleReBar creates a rebar control, and the menu is one of the rebar bands, created by m_CmdBar.Create - WTL's CCommandBarCtrl class. The latter custom-draws the menu to mimic OS behavior, including blue highlighting with COLOR_MENUHILIGHT (atlctrlw.h).