Solved

CreateWindow/Ex function creates object in different fonts

Posted on 1998-06-30
2
672 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
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
substring method in java 1 130
format the code in java 6 102
pre4 challenge 19 104
Is there a standard name for this icon in Technical Writing 10 64
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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…

830 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