By default CPropertysheet uses System Font which creates problem in non-english language, so would like to set the font explicity which will be compatible with all languages.
CPropertySheet is derived from CWnd, so it has a SetFont member function. Have you tried that?
When using SetFont it is necessary to make the CFont object a member variable so it will live as long as the window.
Which text are you trying to change? The text on the tabs is displayed by a tab control which is an embedded member of CPropertySheet. So the solution may be that you need to call SetFont on the tab control. CPropertySheet::GetTabControl can be used to give you access to the control, as shown in this example:
http://msdn.microsoft.com/en-us/library/dftahdhz.aspx
Look at these resources:
CPropertySheet size increased in Windows 8.1 chinese
mfc property sheet getting resized on japanese operating system?
Changing font of Property Sheet dialog
MFC contains bug in _AfxChangePropPageFont() and AfxGetPropSheetFont() methods. It has been fixed for Japanese but not Chinese.
Related
I'm trying to display a ToolTip for a CStatic derived control in my dialog.
What I've already done:
Added a CMFCToolTipCtrl item to my CDialogEx member.
In the init dialog member I've specified CMFCToolTipInfo structure and passed it as argument in CMFCToolTipCtrl item constructor.
Call the EnableToolTips(); member for my CStaticExts and for my CDialogEx.
Overrided the PreTranslateMessage of my CDialogEx adding the "RelayEvent".
Set "Notify: TRUE" in the resource editor.
Doing so I managed to display the tooltip in a partially customized way (baloon and background color) but now I would like to enlarge the font, make it bold and, eventually, display an icon, similarly to the tool tips I can see on my toolbar.
I already tried calling "SetFont" and "SetIcon" methods for the CMFCToolTipCtrl item but it didn't work.
Is that possible?
The normal Font that is used in CMFCToolTipCtrl ist retrieved from a global data store inside the MFC (see GetGlobalData()->fontTooltip). This data structure AFX_GLOBAL_DATA is filled when the MFC is started. SetFont has no effect here.
If you want to change the behaviour you have to create your own CMFCToolTipCtrl class and overwrite OnDrawLabel. You have the source of the MFC so it is easy to provide your own implementation.
As you know that MFC's CFontDialog does only support int in Font size.
And if you checked MS Office you'll find that the Font Dialog supports Float font size normally.
So what is the appropriate way to implement this feature
Is there any implemented font dialog I may use in MFC?
Is there any external 3rd parity library or code?
Should I inherit the CFontDialog and implement the feature and is this applicable?
May I use a .NET dialog and call it in MFC?
MS Office doesnt use CFont Dialog. You cant use CFont dialog to support decimal numbers. Check this discussion about the same topic.
Changed the Point size of the Font I am using to double.
Added a Drop Down Combobox that allow editing.
Handled two events for the Combo, Edit and Selection Changed.
It worked like charm, without creating a Dialog
I am running my English application in Arabic Windows. It contains a property sheet UI (MFC). Everything seems to be fine (Left-To-Right or LTR), except the buttons (OK, Cancel, Apply, and Help) which are Right-To-Left or RTL. But how to make the buttons LTR?
I played around with the flag PSH_RTLREADING mentioned on MSDN but it only deals with the window caption, not the buttons.
Besides, I noticed this dicussion but there is not a good solution.
The answer is given by Raymond Chen [1] and another Microsoft employee [2]; you have to remove the WS_EX_LAYOUTRTL style from the buttons in the window created by your CDialog (aka CPropertySheet). You can either do this globally when you create your CMainFrame and inherit it to all child windows, or locally by changing the window style from GWL_EXSTYLE.
[1] http://blogs.msdn.com/b/oldnewthing/archive/2010/06/11/10023274.aspx
[2] http://social.msdn.microsoft.com/Forums/en/vcgeneral/thread/057612e7-6cd4-44cf-a746-6370ace5de09
Code Used:
m_pButton->Create(L"ABC", WS_CHILD | WS_VISIBLE| BM_SETIMAGE,CRect(0,0,100,100),this,ID_BUTTON1);
m_pButton->SetIcon(::LoadIcon(AfxGetApp()->m_hInstance, MAKEINTRESOURCE(IDI_ICON1)));
//above Code show neither showing image nor showing text.
You might use CMFCButton if you are using VS 2008 SP1 or higher.
BM_SETIMAGE is not a button style, but a message which is sent to the window in order to set a bitmap.
What you probably want is the BS_BITMAP style. Unfortunately as far as I know, it is not possible to have both text and a bitmap on a standard button. But you should find plenty of working implementations of a custom button class on sites like codeguru or codeproject.
BS_ICON and BS_BITMAP must be both unset to enable icon and text on the same button.
See https://msdn.microsoft.com/en-us/library/bb761822(VS.85).aspx
WPF might be able to do this. But, changing GUI topkits might not be an option anyway.
You could override the DrawItem method in CButton. For details check out the following links:
CButton::DrawItem
Owner drawn button - step by step
I'm trying to resize dynamically a CMFCPropertySheet to add a custom control at the bottom of each page.
As all Property Pages are not of the same height, I have a mechanism to increase the size if necessary.
For this, I have overridden the OnActivatePage method and by using SetWindowPos, I can resize the sheet, first, then the tab control, then the page and finally I can move the OK/Cancel/Help buttons.
It works fine with PropSheetLook_OutlookBar and PropSheetLook_Tabs styles but not with PropSheetLook_OneNoteTabs style. The page (or the tab) is not correctly resized (the lighter grey color of the page does not fill the sheet.
OneNote style OneNote http://www.freeimagehosting.net/uploads/th.ec91600664.jpg
Outlook style Outlook http://www.freeimagehosting.net/uploads/th.319b6938ab.jpg
Any idea? A MFC Feature Pack bug?
I found the problem. One needs to get a reference to the different tab control the OneNote version uses via GetTab() and resize it accordingly.
Just follow the instructions as seen in here.
Although the instructions are for CPropertySheet they work for the CMFCPropertySheet as well.
Some parts of the code is deprecated so you will need to make the following amendments.
Skip the XmnPropSheetCallback and DoModal implementations completely
In OnInitDialog just make a call to CPropertySheet::OnInitDialog(); and then call OnSize instead of doing everything presented in that code.