Originally posted by: Amy
Is there a way to change the color of the static text in a dialog?
ReplyOriginally posted by: Thomas Leidlmair
I spent also a lot of time an this problem and that's what
1) the system font
typedef struct tagNONCLIENTMETRICS {
Look at the last item and you have found the system font.
2) modeless dialogs
BOOL Create(UINT nIDTemplate, CWnd* pParentWnd = NULL);
(Sorry, not virtual). A very stupid function, cause we have
BOOL CMyDialog::Create(CWnd* pParentWnd)
if(!dlt.Load(m_lpszTemplateName))
// set the font
// get pointer to the modified dialog template
return CDialog::CreateIndirect(pdata, pParentWnd);
The m_lpszTemplateName is a member of CDialog. The
3) form views
Good luck, Tom
Hi Dimitri, nice work!
I have found out:
Use the SystemParametersInfo(), but set the uiAction
parameter to SPI_GETNONCLIENTMETRICS. When you do this,
you have to provide a pointer to a NONCLIENTMETRICS struct
in the pvParam parameter. This structure looks like this:
UINT cbSize;
int iBorderWidth;
int iScrollWidth;
int iScrollHeight;
int iCaptionWidth;
int iCaptionHeight;
LOGFONT lfCaptionFont;
int iSmCaptionWidth;
int iSmCaptionHeight;
LOGFONT lfSmCaptionFont;
int iMenuWidth;
int iMenuHeight;
LOGFONT lfMenuFont;
LOGFONT lfStatusFont;
LOGFONT lfMessageFont;
} NONCLIENTMETRICS, FAR* LPNONCLIENTMETRICS;
You set up your modeless dialog with
to tell CDialog the template once again (Remember, we
already did this at the construction).
The solution: Write your own Create function:
{
CDialogTemplate dlt;
return FALSE;
LPSTR pdata = (LPSTR)GlobalLock(dlt.m_hTemplate);
}
constuctor stores the template id in this variable.
CFormView overrides the Create function of CWnd (Take a
look at it in
...\MICROSOFT VISUAL STUDIO\VC98\mfc\SRC\viewform.cpp).
It uses the CreateDlg function (not documented and not
virtual, of course) of CWnd to load the resource.
Overriding the hole Create function of CFormView is the
only way to bring your CDialogTemplate into play. Copy the
source from the CFormView, insert the code for
CDialogTemplate and replace CreateDlg with
CreateDlgIndirect (also not documented, but looks like
CDialog::CreateIndirect). Don't forget to
include ...\MICROSOFT VISUAL STUDIO\VC98\mfc\SRC\afximpl.h!
Originally posted by: Lionel THIEBAUT
Hi,
Does anybody knows how to include and/or mix greek characters (for mathematics) in button controls ? For example "Angle (Beta)" where Beta should be replaced by the corresponding greek letter.
Thanks a lot
ReplyOriginally posted by: Manoj
Can't we use this handler to change font at run time?using
logical font?
Originally posted by: Rajesh Shetty
Can anyone tell me if there is an equivalent for CFont::CreatePointFont() function in SDK.
Or how to create a 10.5 point size font in VC.
regards
Hi
Rajesh
Originally posted by: Maria
When I use this technique of overriding the DoModal() function, all of the controls font sizes are changed and resized, but the combo boxes are empty. Without this code they have data at run time, but with it they have empty drop down lists. Does anyone know what the problem could be? By the way, otherwise this function is great!!!! It has really helped.
-Maria
Originally posted by: Rajesh Shetty
How to create fonts in 0.5 units. For eg NS Sans of 5.5.
regards
RajeshS
Originally posted by: adi
if i my controls on the dialog, in MFC dialog editor, and the user changes his system font, the dialog resizes, and all controls are not aligned anymore. How can i disable this "scaling" function?
ReplyOriginally posted by: Ying
How can I change the font name and size overall on my application which is in the old C style? I'm using the following code for the dialogs:
hDlg = CreateDialog(hSetupInst, MAKEINTRESOURCE(dwDlgID), hParent, wpDlgProc);
Currently the font name and size setting for the dialogs is in the RC file, and I have tons of dialogs.
Thanks,
Originally posted by: Arah Leonard
This is definately helpful. And I'd love to implement something like this to save me program from the evil large/small font issue.
But...
My program has close to a hundred different dialogs. And I'm not sure that it's worth the time to put this change into a hundred files. Especially when it would be so repetetive.
Is there any way to create a class which inherits CDialog, but uses this resizing feature as well, so that I can just set my windows to all inherit this CSuperDialog instead of just a plain old CDialog? Thus I would have no other code changes to make than just changing the inheritance of my windows...
Reply