Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 685
  • Last Modified:

CreateWindow/Ex function creates object in different fonts

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
SamratAshok
Asked:
SamratAshok
  • 2
1 Solution
 
raybCommented:
If you are indeed using MFC then you can call the CWnd::SetFont which through inheritance is also a member of CButton.


0
 
raybCommented:
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now