Thread: WM_SETFONT, Static Control

  1. #1
    Registered User
    Join Date
    Dec 2001
    Posts
    60

    WM_SETFONT, Static Control

    As I learned at the ,MSDN library' one can send a WM_SETFONT message to a Static control. My problem: There are dozens of pages dealing with fonts there, and I don't intend to create a font. I would like to have some influence on the Size of the default Arial font. Isn't there something like

    SendMessage(hstatic1,WM_SETTEXTSIZE,(WPARAM) 12,
    (LPARAM) "Bold");

    >> ?

    Could you give me something like the shortest working version of a manipulation of a text's size inside a Static control (that is already filled with text by CreateWindowEx(0,"Static","This text
    is displayed in a default size", ...)?

    It is funny that changing images displayed in Static controls is easier than changing a text's size in Text-Static-Controls.

    Something different:
    I make good progress in programming a card game ,Poker', and I thought I could need the bitmap resources in a different project some day. Therefore I tried to create a WIN32 library containing only the bitmap resources. But MAKEINTRESOURCE(IDB_BITMAP1) does not work anylonger, though I include the same header "resource.h" and add the library to my project. Wasn't it fine if one could build such libraries?

  2. #2
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    Why don't you want to create the font? It is very easy, almost all of the parameters to CreateFont() simply use the default, you can certainly change the point size and set the style to bold.

    Code:
    HFONT hFont;
    
    hFont = CreateFont(12,
                       0,
                       0,
                       0,
                       FW_BOLD,
                       0,
                       0,
                       0,
                       ANSI_CHARSET,
                       OUT_DEFAULT_PRECIS,
                       CLIP_DEFAULT_PRECIS,
                       DEFAULT_QUALITY,
                       DEFAULT_PITCH, | FF_DONTCARE,
                       "Arial");
    Presto, 12pt Bold Arial, and a handle all ready to use with WM_SETFONT.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  3. #3
    Registered User
    Join Date
    Dec 2001
    Posts
    60

    thx adrianx(?)

    This really helped me out of my misery.

  4. #4
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    remember it is your responsibility to DeleteObject() the font after your app has finished with it (ie on close, when new one is created)
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Seg Fault in Compare Function
    By tytelizgal in forum C Programming
    Replies: 1
    Last Post: 10-25-2008, 03:06 PM
  2. seg fault at vectornew
    By tytelizgal in forum C Programming
    Replies: 2
    Last Post: 10-25-2008, 01:22 PM
  3. LNK2001 ERROR!!! need help
    By lifeafterdeath in forum C++ Programming
    Replies: 7
    Last Post: 05-27-2008, 05:05 PM
  4. get keyboard and mouse events
    By ratte in forum Linux Programming
    Replies: 10
    Last Post: 11-17-2007, 05:42 PM
  5. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM