Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Changing text/backgrd of API-buttons

Hi,
I got a problem with API-buttons:

In my program I want to use skins. So far, loading the skins work, that's not the problem.
But now, if I want to use buttons or checkboxes which were created by the CreateWindow function in my project, these look very stupid, as they don't fit into the layout.
E.g.: I need a checkbox on a black background, but the checkbox background color can't be changed.

(
At this adress you can have a look at what I mean:
http://www.forum-3dcenter.de/vbulletin/attachment.php?s=&postid=430733
)

That's where I need your help:
How can I change the text/background color of those elements?

My application looks like this:

- WinMain method which creates the main window and calls the WndProc
- in the WndProc the checkboxes are created under the WM_CREATE message with a separate CreateWindow function

Do you know a solution for this?

Comments

  • pingpongpingpong Member Posts: 937
    This came up in this message board a few times before.

    Just search for "transparent" and maybe "WM_CTLCOLORSTATIC", I'm sure you find what you are looking for.
    : Hi,
    : I got a problem with API-buttons:
    :
    : In my program I want to use skins. So far, loading the skins work, that's not the problem.
    : But now, if I want to use buttons or checkboxes which were created by the CreateWindow function in my project, these look very stupid, as they don't fit into the layout.
    : E.g.: I need a checkbox on a black background, but the checkbox background color can't be changed.
    :
    : (
    : At this adress you can have a look at what I mean:
    : http://www.forum-3dcenter.de/vbulletin/attachment.php?s=&postid=430733
    : )
    :
    : That's where I need your help:
    : How can I change the text/background color of those elements?
    :
    : My application looks like this:
    :
    : - WinMain method which creates the main window and calls the WndProc
    : - in the WndProc the checkboxes are created under the WM_CREATE message with a separate CreateWindow function
    :
    : Do you know a solution for this?
    :

  • Kennung1Kennung1 Member Posts: 18
    [b][red]This message was edited by Kennung1 at 2002-9-27 2:8:26[/red][/b][hr]
    Thx,
    I had a look for it and, well, SOMETHING works :)

    but not quite like I wanted it to work.
    Have a look at these small pictures:
    This is how it was before: http://home.arcor.de/iotha/temp/normal.jpg
    This is after I catched the WM_CTLCOLORSTATIC message: http://home.arcor.de/iotha/temp/changed.jpg


    [code]
    WM_INITDIALOG: begin

    hBrush := CreateSolidBrush(RGB(255, 0, 0));

    end;

    WM_CTLCOLORSTATIC:begin
    //Damit der Schrifthintergrund nicht strt, machen wir das Editfeld transparent
    if (LongWord(lParam) = GetDlgItem(hwnd, ID_CHECKBOX1)) then begin
    // SetBkMode (HDC(wParam), TRANSPARENT);
    SetBkColor(HDC(wParam),RGB(0,0,0));
    SetTextColor(HDC(wParam), RGB(255, 255, 255));
    result:=GetStockObject(NULL_BRUSH);
    end;
    end;
    [/code]

    When I finish the WM_CTLCOLORSTATIC with

    result:=hbrush;

    then it doesn't work... ("result" is similar to C++ "return")
    Do you have any idea how to make the WHOLE checkbox transparent, so that I don't see any grey on this control?

    : This came up in this message board a few times before.
    :
    : Just search for "transparent" and maybe "WM_CTLCOLORSTATIC", I'm sure you find what you are looking for.


  • pingpongpingpong Member Posts: 937
    Try adding WM_EX_TRANSPARENT to the checkbox styles. Either through SetWindowLong or in your CreateWindowEx.

    : [b][red]This message was edited by Kennung1 at 2002-9-27 2:8:26[/red][/b][hr]
    : Thx,
    : I had a look for it and, well, SOMETHING works :)
    :
    : but not quite like I wanted it to work.
    : Have a look at these small pictures:
    : This is how it was before: http://home.arcor.de/iotha/temp/normal.jpg
    : This is after I catched the WM_CTLCOLORSTATIC message: http://home.arcor.de/iotha/temp/changed.jpg
    :
    :
    : [code]
    : WM_INITDIALOG: begin
    :
    : hBrush := CreateSolidBrush(RGB(255, 0, 0));
    :
    : end;
    :
    : WM_CTLCOLORSTATIC:begin
    : //Damit der Schrifthintergrund nicht strt, machen wir das Editfeld transparent
    : if (LongWord(lParam) = GetDlgItem(hwnd, ID_CHECKBOX1)) then begin
    : // SetBkMode (HDC(wParam), TRANSPARENT);
    : SetBkColor(HDC(wParam),RGB(0,0,0));
    : SetTextColor(HDC(wParam), RGB(255, 255, 255));
    : result:=GetStockObject(NULL_BRUSH);
    : end;
    : end;
    : [/code]
    :
    : When I finish the WM_CTLCOLORSTATIC with
    :
    : result:=hbrush;
    :
    : then it doesn't work... ("result" is similar to C++ "return")
    : Do you have any idea how to make the WHOLE checkbox transparent, so that I don't see any grey on this control?
    :
    : : This came up in this message board a few times before.
    : :
    : : Just search for "transparent" and maybe "WM_CTLCOLORSTATIC", I'm sure you find what you are looking for.
    :
    :
    :

  • pingpongpingpong Member Posts: 937
    And if that doesnt work, try these as well:

    Adding WS_CLIPCHILDREN to window/dialog styles.
    Adding WS_CLIPSIBLINGS to your checkbox.

    One of the combination should work


    : Try adding WM_EX_TRANSPARENT to the checkbox styles. Either through SetWindowLong or in your CreateWindowEx.
    :
    : : [b][red]This message was edited by Kennung1 at 2002-9-27 2:8:26[/red][/b][hr]
    : : Thx,
    : : I had a look for it and, well, SOMETHING works :)
    : :
    : : but not quite like I wanted it to work.
    : : Have a look at these small pictures:
    : : This is how it was before: http://home.arcor.de/iotha/temp/normal.jpg
    : : This is after I catched the WM_CTLCOLORSTATIC message: http://home.arcor.de/iotha/temp/changed.jpg
    : :
    : :
    : : [code]
    : : WM_INITDIALOG: begin
    : :
    : : hBrush := CreateSolidBrush(RGB(255, 0, 0));
    : :
    : : end;
    : :
    : : WM_CTLCOLORSTATIC:begin
    : : //Damit der Schrifthintergrund nicht strt, machen wir das Editfeld transparent
    : : if (LongWord(lParam) = GetDlgItem(hwnd, ID_CHECKBOX1)) then begin
    : : // SetBkMode (HDC(wParam), TRANSPARENT);
    : : SetBkColor(HDC(wParam),RGB(0,0,0));
    : : SetTextColor(HDC(wParam), RGB(255, 255, 255));
    : : result:=GetStockObject(NULL_BRUSH);
    : : end;
    : : end;
    : : [/code]
    : :
    : : When I finish the WM_CTLCOLORSTATIC with
    : :
    : : result:=hbrush;
    : :
    : : then it doesn't work... ("result" is similar to C++ "return")
    : : Do you have any idea how to make the WHOLE checkbox transparent, so that I don't see any grey on this control?
    : :
    : : : This came up in this message board a few times before.
    : : :
    : : : Just search for "transparent" and maybe "WM_CTLCOLORSTATIC", I'm sure you find what you are looking for.
    : :
    : :
    : :
    :
    :

  • Justin BibJustin Bib USAMember Posts: 0

    ________ | http://forcoder.org | free video tutorials and ebooks about // Objective-C, MATLAB, Visual Basic .NET, Scratch, C#, Ruby, C, PL/SQL, JavaScript, Assembly, C++, Go, Perl, Java, R, Delphi, Swift, PHP, Visual Basic, Python Scheme, Crystal, Logo, Rust, SAS, Apex, VBScript, Dart, Lua, Ada, LabVIEW, Awk, Scala, Prolog, Clojure, F#, Alice, Fortran, COBOL, Erlang, FoxPro, D, Hack, Kotlin, Transact-SQL, ML, Julia, Bash, Lisp, ABAP // ______________

Sign In or Register to comment.