I keep having the same problem everytime I try to transfer my program over to a computer with the large fonts enabled in the display settings. My VC++6 dialog program uses controls that I have placed in the dialog editor, and I want everything to be "exactly" the same size and in the same place. However, even if I set the font on the dialog, Windows keeps messing it up and changing the size and all of the controls in the dialog box and even the dialog itself.
I can't figure out what to do any more so i'm offering 300+ points for anyone who can give me an "excelent" solution to this problem. I think the only way around this problem is to somehow disable the large fonts feature for my program.(I still want to create my dialog in the resource editor; I don't want to waste my time creating all the controls during runtime.)
Indeed, I would like to see an answer to this as well. I have had similar problems.
Do you have problems with cut-off text? Or do you just want it all to be the exact same size on all computers?
0
SileNcerAuthor Commented:
Both would be nice =), I think it also originates from the same problem. It seems that even though I choose the "size to content" command on my static text, the darn large fonts takes over and won't display the whole string; the only solution I have found for this is to give extra room for each control, but this causes some of my dialogs to not look right in a regular fonts display.
0
SileNcerAuthor Commented:
Edited text of question
0
Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.
There are several parameters in the system registry:
HKEY_LOCAL_MACHINE\config\0001\display\settings
DPILogicalX and DPILogicalY for small fonts this value are setted 96 DPI
for large fonts these values properly changed, so if you set large font with aspect 120% these values setted to the 115 DPI
That could correct the problem, but the computer would have to be rebooted before the font size would change. I doubt the user would want to reboot to run a program :-)
<< thresher_shark
<< I doubt the user would want to reboot to run a program :-)
As I understand you want chage registry to get correct dialog appearance. It isn`t good idea.
I say that you can get inforamation about font scale. Once getted this info you can change dialogs font size at ruintime.
0
SileNcerAuthor Commented:
<<migel
<<I say that you can get inforamation about font scale. Once <<getted this info you can change dialogs font size at ruintime.
So are you saying I can take the registry information and somehow use it with CreateFont() and set the dialog to it so the font will always be the same size? If so, how could something like this be done? And...would the resource editor be able to use this font as well?
I try change font at runtime and here is my code:
// Note it is only example
// derive own class from the CDialog and override DoModal method.
Platform Win95 compiler MS VC++ v 6.0 (but must compiled with another compiler)
(Caption font and caption dimentions is not changed) -
// override DoModal dialog method
int CAboutDlg::DoModal()
{
// first getting info
HKEY hKeyScale = 0;
DWORD wType = REG_SZ;
TCHAR szBuffer[18] = _T("");
DWORD dwSize = sizeof(szBuffer);
RegOpenKey(HKEY_LOCAL_MACHINE, "config\\0001\\display\\settings", &hKeyScale);
RegQueryValueEx(hKeyScale,"DPILogicalX", NULL, &wType, (LPBYTE)szBuffer, &dwSize);
WORD wScale = (WORD)atol(szBuffer);
if (hDialogTemplate != NULL)
lpDialogTemplate = (LPDLGTEMPLATE)LockResource(hDialogTemplate);
// find font record
// return -1 in case of failure to load the dialog template resource
if (lpDialogTemplate == NULL)
return -1;
WORD* lpByte = (WORD*) lpDialogTemplate;
lpByte += sizeof(*lpDialogTemplate)/sizeof(WORD);
if (*lpByte) // Menu
{
if (*lpByte == 0xFFFF)
lpByte += 2; // mark and menu ID
else
while (*(lpByte++)) NULL;
}
else
lpByte++;//skip zero
if (*lpByte) // class
{
if (*lpByte == 0xFFFF)
lpByte += 2; // mark and menu ID
else
while (*(lpByte++)) NULL;
}
else
lpByte++; //skip zero
if (*lpByte) // title
while (*(lpByte++)) NULL;
else
lpByte++ ;//skip zero
if (lpDialogTemplate->style & DS_SETFONT)
{
// set WORD boundary
WORD *lpSize = lpByte;
*lpSize = MulDiv(*lpSize, 96, wScale);
lpByte++; // start font name
while (*(lpByte++)) NULL;
}
// correct dialog sizes
lpDialogTemplate->x = MulDiv(lpDialogTemplate->x, 96, wScale);
lpDialogTemplate->y = MulDiv(lpDialogTemplate->y, 96, wScale);
lpDialogTemplate->cx = MulDiv(lpDialogTemplate->cx, 96, wScale);
lpDialogTemplate->cy = MulDiv(lpDialogTemplate->cy, 96, wScale);
lpByte += sizeof(*lpItems)/sizeof(WORD);
// WORD alignment
lpByte = (LPWORD)((((DWORD)(lpByte)+1)/sizeof(WORD))*sizeof(WORD));
if (*lpByte == 0xFFFF)
lpByte += 2; // mark and class ID
else
{
while (*(lpByte++)) NULL;
//lpByte++; // skip zero
}
// WORD alignment
lpByte = (LPWORD)((((DWORD)(lpByte)+1)/sizeof(WORD))*sizeof(WORD));
if (*lpByte == 0xFFFF) // title
lpByte += 2; // mark and resource ID
else
{
while (*(lpByte++)) NULL;
//lpByte++; // skip zero
}
// WORD alignment
lpByte = (LPWORD)((((DWORD)(lpByte)+1)/sizeof(WORD))*sizeof(WORD));
if (*lpByte) // control creation data
{
if (*lpByte == 0xFFFF)
lpByte += 2; // mark and menu ID
else
while (*(lpByte++)) NULL;
//lpByte++; // skip zero
}
else
lpByte++; //skip zero
lpByte = (LPWORD)((((DWORD)(lpByte)+3)/sizeof(DWORD))*sizeof(DWORD));
}
m_lpszTemplateName = NULL;
InitModalIndirect(lpDialogTemplate);
int nRes = CDialog::DoModal();
UnlockResource(hDialogTemplate);
FreeResource(hDialogTemplate);
return nRes;
}
Thank you for help me. Unfortunately I don't use DoModal. I Create the dialog and use it in a not modal way.
And I wanted a solution to the problem without changing the font size.
0
Question has a verified solution.
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.
One of a set of tools we're offering as a way of saying thank you for being a part of the community.
Do you have problems with cut-off text? Or do you just want it all to be the exact same size on all computers?