0 Replies - 194 Views - Last Post: 04 May 2019 - 01:51 AM

#1 BCriss   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 04-May 19

Change background color of a element in a main window

Posted 04 May 2019 - 01:51 AM

Hello :)/>

I have a main window application, inside which I have windows with elements like bitmaps, buttons, text, etc.
How do I change the background color for one of them? For example a message line, defined like this:
; Message line
Invoke CreateWindowEx, WS_EX_CLIENTEDGE,
       ADDR szStatic,
       NULL,
       SS_CENTER or WS_BORDER or WS_CHILD or WS_VISIBLE,
       50, 50, 200, 30,
       hWnd, cID_stMSGLINE, hInst, NULL
mov hMSGLINE,eax


Where hWnd is the handle of the main application window.
How do I change the background color only of the hMSGLINE window?
I tried intercepting the Erasebackground event like this:
CASE WM_ERASEBKGND
    RGB 0,200,25
    invoke CreateSolidBrush,eax
    invoke SetClassLong, hwin, GCL_HBRBACKGROUND, eax


But only the background of the main window gets changed.

Can anyone provide a simple example of main window with a background color with a text window in it with different background color?
Thank you for your help !

Is This A Good Question/Topic? 0
  • +

Page 1 of 1