[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Win32 VC++: Multiple Fonts in One Dialog?

Posted on 1997-06-22
4
Medium Priority
?
326 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
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 how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Suggested Courses

650 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