Solved

CreateWindow/Ex function creates object in different fonts

Posted on 1998-06-30
2
665 Views
Last Modified: 2013-12-03
Hi

I have an application that consists of about 15/20 buttons on about 20/30 forms. Depending upon the user's
rights and current and last activity performed, about 4-5 of them are active.

I recently derived a class to handle the common activities, Instead of creating 30 forms with the same
button map below, I decided to use CreateWindow function and creates button at runtime.
Positioning of button worked out very fine simply by use of bounding static control and computing
each size from it.

Problem is that button fonts are always Bold. While I know the WM_PAINT and Windows DC
functions, I do want to write separate Windowproc to redraw buttons (effectively re-inventing wheel)

I also tried CreateWindowEx but with no luck

Any suggestions
0
Comment
Question by:SamratAshok
  • 2
2 Comments
 
LVL 2

Accepted Solution

by:
rayb earned 100 total points
Comment Utility
If you are indeed using MFC then you can call the CWnd::SetFont which through inheritance is also a member of CButton.


0
 
LVL 2

Expert Comment

by:rayb
Comment Utility
If you are not using MFC, you can try something similar to this:

::SendMessage(m_hWnd, WM_SETFONT, (WPARAM)pFont->GetSafeHandle(), bRedraw);
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
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…

762 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now