?
Solved

Win32 VC++: Multiple Fonts in One Dialog?

Posted on 1997-06-22
4
Medium Priority
?
324 Views
Last Modified: 2013-12-03
Hello.

Using VC++ 5.0 and MFC, I am trying to create a dialog
which will be able to display one text field in a large
font and the rest of the fields and buttons in a normal,
smaller font. So far, I have only been able to do this with
a splitter view, but I would like to know how it can be
done in a single dialog or form view. The basic problem is
that the font attribute is attached to the entire dialog
and not to specific fields contained within.

Please let me know how I can create one dialog with fields
in different fonts without using a splitter view.

Thanks.
0
Comment
Question by:FNORD0
[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
4 Comments
 

Author Comment

by:FNORD0
ID: 1164016
Edited text of question
0
 
LVL 23

Accepted Solution

by:
chensu earned 800 total points
ID: 1164017
You can create some Static Controls with different fonts in the dialog box.

BOOL CYourDialog::OnInitDialog()
{
    ...
    // m_font is a member variable of CYourDialog
    m_font.CreatePointFont(12, "Arial");
    CWnd *pStatic = this->GetDlgItem(ID_STATIC1);
    pStatic->SetFont(&m_font);
    ...
}

You can also use this method to change the font of the buttons.

You can even change the color of the static controls. See MFC Technical Notes: TN062: Message Reflection for Windows Controls.
0
 

Author Comment

by:FNORD0
ID: 1164018
Great answer. I'm going to try that right now. Thanks!
0
 

Expert Comment

by:Jeffrey1
ID: 2701922
This works great!  If you are looking at how to change the font in a contol on your dialog, look no more.  This is clean, simple, and it works.

One thing, though; the first parameter in CreatePointFont() is in tenths of a point.  In the above example, to get 12 point, you would need a value of 120.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Suggested Courses

801 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