Thread: changing the background color

  1. #1
    Registered User
    Join Date
    Apr 2005
    Posts
    98

    changing the background color

    how can i change the background color of a static control?
    please don't give me links to other posts in this forum, coz i've looked in them all and still didn't understand.

  2. #2
    Registered User
    Join Date
    Feb 2002
    Posts
    329
    Handle the WM_CTLCOLORSTATIC message.

  3. #3
    Registered User
    Join Date
    Apr 2005
    Posts
    98
    thanks, it works =)
    i have another question:
    how can i make the cursor change to that specific cursor (don't know its name) when it hovers the text?

  4. #4
    yes, I'm registered!!! algi's Avatar
    Join Date
    Nov 2004
    Location
    Ipswich
    Posts
    161
    if you want to do it for the whole window it's
    Code:
    LoadCursor(NULL, IDC_IBEAM);
    I started out with nothing and I still have most of it left.

  5. #5
    Registered User
    Join Date
    Apr 2005
    Posts
    98
    but then it will be the cursor even when my mouse isn't over the text right? i want it to be like when u move ur mouse over the text of this message and the cursor changes

  6. #6
    Chief Code Coloniser!
    Join Date
    Apr 2005
    Posts
    121
    algi: doesn't that just load a system icon?? that's got nothing to do with setting it?

    hiya: just use SetIcon() to set the icon when the cursor is over text. It's that simple!

  7. #7
    Registered User
    Join Date
    Apr 2005
    Posts
    98
    but it's in MFC right? and i'm using API

  8. #8
    Registered User
    Join Date
    Feb 2002
    Posts
    329
    It's not MFC.
    Look it up in MSDN

  9. #9
    Registered User
    Join Date
    Jan 2005
    Posts
    847
    The only way I know of to set a window's cursor when using APIs is by setting the cursor in the WNDCLASSEX structure when the window's class is registered. Maybe you could create your own static control window.

  10. #10
    Registered User
    Join Date
    Feb 2002
    Posts
    329
    Use SetCursor()
    Code:
    HICON hCurDrag, hCurNoDrop;
    hCurDrag = (HICON)LoadImage(d->hInst, MAKEINTRESOURCE(CUR_DRAG), IMAGE_CURSOR, 0, 0, LR_DEFAULTCOLOR);
    hCurNoDrop = (HICON)LoadImage(d->hInst, MAKEINTRESOURCE(CUR_NODROP), IMAGE_CURSOR, 0, 0, LR_DEFAULTCOLOR);
    SetCursor(hCurDrag);
    SetCursor(hNoDrop);
    Works fine for me in API

  11. #11
    Registered User
    Join Date
    Apr 2005
    Posts
    98
    hehe you said SetIcon at start (i also didn't notice it has nothing to do with cursors).
    ok it's ok now, thanks.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Critique my lighting model.
    By psychopath in forum Game Programming
    Replies: 4
    Last Post: 08-12-2006, 06:23 PM
  2. Changing the background color
    By SwiftOutlaw in forum Windows Programming
    Replies: 3
    Last Post: 12-21-2004, 10:18 PM
  3. Changing background color of irregular image
    By Tesita in forum C++ Programming
    Replies: 5
    Last Post: 11-03-2003, 08:17 PM
  4. Just one Question?
    By Irish-Slasher in forum C++ Programming
    Replies: 6
    Last Post: 02-12-2002, 10:19 AM