Solved

Why this abnormal behaviour?

Posted on 1998-06-04
3
245 Views
Last Modified: 2013-11-20
Hi MFC gurus,

I have a CFormview with 5 edit controls. I want to set the font of these edit controls with a font selected from a CFontDialog. For this I used SetFont method of CWnd. Font is getting changed but if I bring my focus to any of the edit control back, the font changes back to system font. Why this abnormal behaviour?

0
Comment
Question by:chacko
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 50 total points
ID: 1315985
It sounds like your font is being destroyed somehow. Make sure the font object you're using is not created on the stack. The easiest way to create a font you need for the dialog, is to create a font data member in your dialog class. In the constructor for the dialog, create the font. Then in the OnInitDialog, set the font for the edit controls.
0
 
LVL 1

Author Comment

by:chacko
ID: 1315986
Thank! It works....
0
 
LVL 1

Author Comment

by:chacko
ID: 1315987
Thanks! It works....
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
mixString challenge 36 137
ASCII Non-Printable characters/codes and their HTML equivalents 6 158
if loop in java 3 174
ShiftLeft challenge 21 95
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question