Click here to Skip to main content
15,914,010 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalbuttons and config file for MFC Pin
catngo13-Apr-04 14:35
catngo13-Apr-04 14:35 
GeneralRe: buttons and config file for MFC Pin
gUrM33T13-Apr-04 15:23
gUrM33T13-Apr-04 15:23 
GeneralCSocket use Pin
dyerstein13-Apr-04 13:18
dyerstein13-Apr-04 13:18 
GeneralRe: CSocket use Pin
vcplusplus13-Apr-04 14:52
vcplusplus13-Apr-04 14:52 
GeneralRe: CSocket use Pin
gUrM33T13-Apr-04 15:26
gUrM33T13-Apr-04 15:26 
GeneralJava & Javascript errors in CHtmlView app Pin
trof13-Apr-04 12:22
trof13-Apr-04 12:22 
Generalchanging font in CEdit Pin
dart1313-Apr-04 11:54
dart1313-Apr-04 11:54 
GeneralRe: changing font in CEdit Pin
Gary R. Wheeler13-Apr-04 15:13
Gary R. Wheeler13-Apr-04 15:13 
You need to ensure that the font exists for the life of the CEdit control. Suppose you're changing the font in the OnInitDialog() handler for your class:
BOOL MyDialog::OnInitDialog()
{
    //...
    CFont myFont;
    myFont.CreatePointFont(120,"Arial");
    myEdit.SetFont(&myFont);
}
This won't work, because as soon as the OnInitDialog function exits, the myFont variable is destroyed, which destroys the font and the edit control reverts to using the standard font.

You fix this by making the myFont value a member of the dialog:
class MyDialog : public CDialog
{
    //...
    CFont myFont;
};
BOOL MyDialog::OnInitDialog()
{
    //...
    myFont.CreatePointFont(120,"Arial");
    myEdit.SetFont(&myFont);
}
Since the myFont variable is a member of the dialog class, it exists for as long as the dialog object, and therefore the edit control.


Software Zen: delete this;
GeneralRe: changing font in CEdit Pin
dart1313-Apr-04 20:41
dart1313-Apr-04 20:41 
GeneralVC6 to VC.NET Pin
brdavid13-Apr-04 11:09
brdavid13-Apr-04 11:09 
GeneralRe: VC6 to VC.NET Pin
Maarten Kools13-Apr-04 11:53
professionalMaarten Kools13-Apr-04 11:53 
GeneralRe: VC6 to VC.NET Pin
Paul Ranson13-Apr-04 12:01
Paul Ranson13-Apr-04 12:01 
GeneralRe: VC6 to VC.NET Pin
brdavid13-Apr-04 15:03
brdavid13-Apr-04 15:03 
GeneralRe: VC6 to VC.NET Pin
Paul Ranson14-Apr-04 4:31
Paul Ranson14-Apr-04 4:31 
General"show Desktop" interceptor Pin
shrimps2413-Apr-04 10:56
shrimps2413-Apr-04 10:56 
GeneralRe: "show Desktop" interceptor Pin
shrimps2413-Apr-04 10:57
shrimps2413-Apr-04 10:57 
GeneralRe: "show Desktop" interceptor Pin
gUrM33T13-Apr-04 15:42
gUrM33T13-Apr-04 15:42 
GeneralStack Problem Clarified Pin
Anonymous13-Apr-04 10:26
Anonymous13-Apr-04 10:26 
GeneralRe: Stack Problem Clarified Pin
Anonymous13-Apr-04 10:27
Anonymous13-Apr-04 10:27 
GeneralRe: Stack Problem Clarified Pin
Daniel Turini13-Apr-04 10:58
Daniel Turini13-Apr-04 10:58 
GeneralRe: Stack Problem Clarified Pin
Anonymous14-Apr-04 1:07
Anonymous14-Apr-04 1:07 
GeneralRe: Stack Problem Clarified Pin
Paul Ranson14-Apr-04 4:20
Paul Ranson14-Apr-04 4:20 
GeneralRelease Mode ATL Problem Pin
nlecren13-Apr-04 9:58
nlecren13-Apr-04 9:58 
GeneralCheck the Status of a URL Pin
Renjith Ramachandran13-Apr-04 8:20
Renjith Ramachandran13-Apr-04 8:20 
GeneralRe: Check the Status of a URL Pin
David Crow13-Apr-04 8:31
David Crow13-Apr-04 8:31 

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.