Click here to Skip to main content
15,905,963 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questioncreating a bitmap // filling colors in "BITMAP" Pin
himuskanhere20-Mar-06 19:07
himuskanhere20-Mar-06 19:07 
AnswerRe: creating a bitmap // filling colors in "BITMAP" Pin
Hamid_RT20-Mar-06 19:54
Hamid_RT20-Mar-06 19:54 
Questionfilling colors in "BITMAP" Pin
himuskanhere20-Mar-06 19:05
himuskanhere20-Mar-06 19:05 
Question__RPC_FAR Pin
HakunaMatada20-Mar-06 18:46
HakunaMatada20-Mar-06 18:46 
AnswerRe: __RPC_FAR Pin
Nibu babu thomas20-Mar-06 19:22
Nibu babu thomas20-Mar-06 19:22 
QuestionChanging the dialog font Pin
Naveen20-Mar-06 18:35
Naveen20-Mar-06 18:35 
AnswerRe: Changing the dialog font Pin
ashokbngr20-Mar-06 18:59
ashokbngr20-Mar-06 18:59 
AnswerRe: Changing the dialog font Pin
ashokbngr20-Mar-06 19:01
ashokbngr20-Mar-06 19:01 
1. place the following string somewhere in your "stdafx.h" file:

#include <afxpriv.h>
2. override DoModal() function in your dialog class:

int CSampleDialog::DoModal()
{
CDialogTemplate dlt;
int nResult;

// load dialog template
if (!dlt.Load(MAKEINTRESOURCE(CSampleDialog::IDD))) return -1;

// set your own font, for example "Arial", 10 pts.
dlt.SetFont("Arial", 10);

// get pointer to the modified dialog template
LPSTR pdata = (LPSTR)GlobalLock(dlt.m_hTemplate);

// let MFC know that you are using your own template
m_lpszTemplateName = NULL;
InitModalIndirect(pdata);

// display dialog box
nResult = CDialog::DoModal();

// unlock memory object
GlobalUnlock(dlt.m_hTemplate);

return nResult;
}

It may be reasonable to choose a font for your dialog box according to user-specified schemes (those in Control Panel / Display / Appearance). Unfortunately I was unable to find any simple ways to get font settings for the dialog boxes. A possible alternative is to use font settings for icon titles and some related controls (like tree and list controls), that can be retrieved by SystemParametersInfo() function. Here is a simple procedure that returns the face name and the size in points for this font:


void GetSystemIconFont(CString& strFontName,int& nPointSize)
{
LOGFONT lf;

// get LOGFONT structure for the icon font
SystemParametersInfo(SPI_GETICONTITLELOGFONT,sizeof(LOGFONT),&lf,0);

// getting number of pixels per logical inch
// along the display height
COLOR="#990000">
HDC hDC = ::GetDC(NULL);
int nLPixY = GetDeviceCaps(hDC, LOGPIXELSY);
::ReleaseDC(NULL,hDC);

// copy font parameters
nPointSize = -MulDiv(lf.lfHeight,72,nLPixY);
strFontName = lf.lfFaceName;
}





Ashok Reddy
GeneralRe: Changing the dialog font Pin
Naveen20-Mar-06 19:35
Naveen20-Mar-06 19:35 
GeneralRe: Changing the dialog font Pin
ashokbngr20-Mar-06 21:39
ashokbngr20-Mar-06 21:39 
AnswerRe: Changing the dialog font Pin
Rajesh R Subramanian20-Mar-06 19:27
professionalRajesh R Subramanian20-Mar-06 19:27 
GeneralRe: Changing the dialog font Pin
Naveen20-Mar-06 19:38
Naveen20-Mar-06 19:38 
QuestionHow to change the skin of my Dialog? Pin
ashokbngr20-Mar-06 18:28
ashokbngr20-Mar-06 18:28 
AnswerRe: How to change the skin of my Dialog? Pin
Nibu babu thomas20-Mar-06 19:30
Nibu babu thomas20-Mar-06 19:30 
AnswerRe: How to change the skin of my Dialog? Pin
Hamid_RT20-Mar-06 19:47
Hamid_RT20-Mar-06 19:47 
GeneralRe: How to change the skin of my Dialog? Pin
J512198220-Mar-06 23:23
J512198220-Mar-06 23:23 
Questionhow to get a image in a .bmp file onto a Dialog in the program? Pin
ewighell20-Mar-06 17:46
ewighell20-Mar-06 17:46 
AnswerRe: how to get a image in a .bmp file onto a Dialog in the program? Pin
Nibu babu thomas20-Mar-06 17:52
Nibu babu thomas20-Mar-06 17:52 
AnswerRe: how to get a image in a .bmp file onto a Dialog in the program? Pin
Hamid_RT20-Mar-06 17:59
Hamid_RT20-Mar-06 17:59 
AnswerRe: how to get a image in a .bmp file onto a Dialog in the program? Pin
Hamid_RT20-Mar-06 18:07
Hamid_RT20-Mar-06 18:07 
AnswerRe: how to get a image in a .bmp file onto a Dialog in the program? Pin
Chris Gao21-Mar-06 9:35
Chris Gao21-Mar-06 9:35 
QuestionDLL Hell Pin
vivek.s.vivek20-Mar-06 17:02
vivek.s.vivek20-Mar-06 17:02 
AnswerRe: DLL Hell Pin
Gavin Taylor20-Mar-06 17:15
professionalGavin Taylor20-Mar-06 17:15 
AnswerRe: DLL Hell Pin
HakunaMatada20-Mar-06 18:38
HakunaMatada20-Mar-06 18:38 
Questionrelated with cookie Pin
baldha rakesh20-Mar-06 16:50
baldha rakesh20-Mar-06 16:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.