Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

SetBkColor

Hi everyone i am new to this forum.
I need help with the api Setbkcolor in Delphi..will someone guide me on how to use Setbkcolor api in delphi.
Thanks in advance.

Comments

  • zibadianzibadian Posts: 6,349Member
    : Hi everyone i am new to this forum.
    : I need help with the api Setbkcolor in Delphi..will someone guide me
    : on how to use Setbkcolor api in delphi.
    : Thanks in advance.
    :
    First you need to get the DC handle for the component, for which the background color needs to be changed. Then you can set the color using its RGB value. The format of the color is (in hex): 00RRGGBB.
    There are alternatives, depending on what you want to do.
  • JunaidNoorJunaidNoor Posts: 3Member
    : First you need to get the DC handle for the component, for which the
    : background color needs to be changed. Then you can set the color
    : using its RGB value. The format of the color is (in hex): 00RRGGBB.
    : There are alternatives, depending on what you want to do.

    Here's How i have done

    First I Got the Dc Handle
    DC:= GetDC(hWnd);

    Then i set the Background Mode
    SetBkMode(DC, OPAQUE);

    Then i create a brush and Set the Color
    CreateSolidBrush(00000000);
    SetBkColor(DC, 00000000);

    But still i have no luck with it :(.. someone guide me :(
  • zibadianzibadian Posts: 6,349Member
    : : First you need to get the DC handle for the component, for which the
    : : background color needs to be changed. Then you can set the color
    : : using its RGB value. The format of the color is (in hex): 00RRGGBB.
    : : There are alternatives, depending on what you want to do.
    :
    : Here's How i have done
    :
    : First I Got the Dc Handle
    : DC:= GetDC(hWnd);
    :
    : Then i set the Background Mode
    : SetBkMode(DC, OPAQUE);
    :
    : Then i create a brush and Set the Color
    : CreateSolidBrush(00000000);
    : SetBkColor(DC, 00000000);
    :
    : But still i have no luck with it :(.. someone guide me :(
    :
    But what do you want to do? This is quite low level coding, and Delphi probably has better ways of handling this.
  • JunaidNoorJunaidNoor Posts: 3Member
    Got it solved :)..Thanks to my bro for guiding me how to do it.. thanks for your help anyway :)
Sign In or Register to comment.