Click here to Skip to main content
15,887,992 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionMessageBox and font changing? Pin
Jump_Around26-Feb-04 23:57
Jump_Around26-Feb-04 23:57 
AnswerRe: MessageBox and font changing? Pin
Prakash Nadar27-Feb-04 0:11
Prakash Nadar27-Feb-04 0:11 
GeneralProblem with critical section. Pin
Prakash Nadar26-Feb-04 23:47
Prakash Nadar26-Feb-04 23:47 
GeneralRe: Problem with critical section. Pin
_Magnus_27-Feb-04 0:11
_Magnus_27-Feb-04 0:11 
GeneralRe: Problem with critical section. Pin
Prakash Nadar27-Feb-04 0:14
Prakash Nadar27-Feb-04 0:14 
GeneralEdit control and Unicode Pin
Jahangir Jamshed26-Feb-04 23:47
sussJahangir Jamshed26-Feb-04 23:47 
GeneralRe: Edit control and Unicode Pin
Prakash Nadar27-Feb-04 0:08
Prakash Nadar27-Feb-04 0:08 
GeneralCRichEdit, default font settings Pin
Shah Shehpori26-Feb-04 23:37
sussShah Shehpori26-Feb-04 23:37 
Friends,

I've a simple dialog based application. I dropped a Rich Edit control on a dialog. I run the program and it runs fine. As such the font typed in the rich edit box is the one provided by Windows as default font.

Now i want to display the text in rich edit box with my custom fonts settings. I got a routine to do so. And i want my font settings to be applied as default when the application runs. So i am calling my function of font change in OnInitDialog().

OnInitDialog()
{
 m_myRichEdit.SetFont("Tahoma");
 m_myrichEdit.SetFontSize(22);
}


But when i run my application, these settings are not getting applied Frown | :( Instead if i remove the code from OnInitDialog() and place it in OnOk() handler then it gets applied if the user presses the OK button.

But i want my settings to be applied immediately when the application runs i.e applied as default.

How can i do so ???

The routines are:

void CRichEditCtrlEx::SetFontName(CString sFontName)
{
   CHARFORMAT cf = GetCharFormat();

	// Set the font name.
   ZeroMemory(cf.szFaceName, 32);

	for (int i = 0; i <= sFontName.GetLength()-1; i++)
		cf.szFaceName[i] = sFontName[i];

	ZeroMemory(cf.szFaceName+ sFontName.GetLength(), 2);

	cf.dwMask = CFM_FACE;

	SetSelectionCharFormat(cf);
   
}

void CRichEditCtrlEx::SetFontSize(int nPointSize)
{
	CHARFORMAT cf = GetCharFormat();

	nPointSize *= 20;	// convert from to twips
	cf.yHeight = nPointSize;
	
	cf.dwMask = CFM_SIZE;

	//SetSelectionCharFormat(cf);
	SetDefaultCharFormat(cf);
}

Questionhow can i make some pictures into Panoramic image Pin
xnew26-Feb-04 23:21
xnew26-Feb-04 23:21 
AnswerRe: how can i make some pictures into Panoramic image Pin
telstar27-Feb-04 8:00
telstar27-Feb-04 8:00 
GeneralProb on Tasktray icons. Pin
Prakash Nadar26-Feb-04 23:13
Prakash Nadar26-Feb-04 23:13 
GeneralRe: Prob on Tasktray icons. Pin
Shog927-Feb-04 5:35
sitebuilderShog927-Feb-04 5:35 
GeneralRe: Prob on Tasktray icons. Pin
Prakash Nadar27-Feb-04 13:40
Prakash Nadar27-Feb-04 13:40 
GeneralRe: Prob on Tasktray icons. Pin
SiddharthAtw27-Feb-04 20:05
SiddharthAtw27-Feb-04 20:05 
GeneralRe: Prob on Tasktray icons. Pin
Prakash Nadar28-Feb-04 0:22
Prakash Nadar28-Feb-04 0:22 
Questionhow to apply fading(DSP) on waveaudio stream Pin
Member 95034326-Feb-04 23:08
Member 95034326-Feb-04 23:08 
GeneralFunction prototype Pin
hph26-Feb-04 23:02
hph26-Feb-04 23:02 
GeneralRe: Function prototype Pin
Prakash Nadar26-Feb-04 23:06
Prakash Nadar26-Feb-04 23:06 
GeneralRe: Function prototype Pin
hph26-Feb-04 23:10
hph26-Feb-04 23:10 
GeneralRe: Function prototype Pin
Prakash Nadar26-Feb-04 23:23
Prakash Nadar26-Feb-04 23:23 
GeneralRe: Function prototype Pin
hph26-Feb-04 23:40
hph26-Feb-04 23:40 
GeneralRe: Function prototype Pin
Prakash Nadar27-Feb-04 0:17
Prakash Nadar27-Feb-04 0:17 
GeneralRe: Function prototype Pin
David Crow27-Feb-04 5:35
David Crow27-Feb-04 5:35 
GeneralRe: Function prototype Pin
Prakash Nadar27-Feb-04 13:37
Prakash Nadar27-Feb-04 13:37 
GeneralRe: Function prototype Pin
Kevin McFarlane27-Feb-04 1:23
Kevin McFarlane27-Feb-04 1:23 

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.