Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Why this abnormal behaviour?

Posted on 1998-06-04
3
Medium Priority
?
248 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 200 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
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.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

636 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