Results 1 to 2 of 2

Thread: text color

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800

    text color

    for now I use this function for font (thanks to a one mr parksie )
    Code:
    void SetFont(HWND hWnd, int iPointSize, const char *pcFontName) {  //(obviously) sets fonts of controls
        
        HFONT hTheFont;
        HDC hDC = GetDC(hWnd);
        int nHeight = -MulDiv(iPointSize, GetDeviceCaps(hDC, LOGPIXELSY), 72);
    
        hTheFont = CreateFont(nHeight, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, pcFontName);
    
        ReleaseDC(hWnd, hDC);
    
        SendMessage(hWnd, WM_SETFONT, (WPARAM)hTheFont, TRUE);
    }
    is there anyway to add a color parameter to this function? I don't know where to start...I've never used color

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    No, not directly. You can use SetTextColor to set the color of text, but you must do it every time you retrieve a DC (for controls, that are the WM_CTLCOLOR* messages)
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width