Results 1 to 7 of 7

Thread: Setting textbox colour

Threaded View

  1. #3

    Thread Starter
    Lively Member
    Join Date
    Feb 2005
    Posts
    116

    Re: Setting textbox colour

    Thanks for the prompt reply. How do I use this?

    Using:
    VB Code:
    1. Debug.Print SendMessage(Text1.hwnd, WM_GETFONT, 0&, 0&)
    2. Debug.Print SendMessage(Text2.hwnd, WM_GETFONT, 0&, 0&)
    gives 889851594 and 889851594 where Text1 has black text and Text2 has red text.

    Could you give me a simple example of just changing the forecolour to red?

    EDIT:
    Just reading around a bit, and it seems like there is no colour associated with font. If I were to use SetTextColor, how do I get the device context of the TextBox?

    EDIT 2:
    Reading around further, came up with the following:
    VB Code:
    1. Dim lngMainTexthDC As Long
    2.    
    3.     lngMainTexthDC = GetDC(txtMainText.hwnd)
    4.     SetTextColor lngMainTexthDC, RGB(255, 0, 0)
    However, this does not work. Still not sure why...
    Last edited by olamm2k; May 16th, 2005 at 04:21 PM.

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