Solved

CreateWindow/Ex function creates object in different fonts

Posted on 1998-06-30
2
676 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
[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
2 Comments
 
LVL 2

Accepted Solution

by:
rayb earned 100 total points
ID: 1318540
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
ID: 1318541
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

Get MongoDB database support online, now!

At Percona’s web store you can order your MongoDB database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card. Handle your MongoDB database support now!

Question has a verified solution.

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

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. …
In this post we will learn different types of Android Layout and some basics of an Android App.
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…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

622 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