Easy question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Scott Turchin
    Member
    • Aug 1998
    • 3171

    Easy question

    Hey guys, I am thinking about creating an app for a test purpose, no big thing at all, just a dialog box and one button to exit it...

    Anyone got code for this that paints the background on the dialog box, say green, or red, or blue? Just one solid color....

    Thanks!

    Scott


    ------------------
    Scott Turchin
    MCSE, MCP+I
    Computer Creations Software
    http://www.tngbbs.com/ccs
    Scott Turchin
    MCSE, MCP+I
    http://www.tngbbs.com
    ----------------------
    True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi
  • Lance Edmonds
    Member
    • Aug 1998
    • 10688

    #2
    Try this:
    Code:
    CALLBACK FUNCTION DlgCB
        LOCAL  LB        AS LOGBRUSH
        STATIC hBrushDlg AS LONG
     
        SELECT CASE CBMSG
            CASE %WM_INITDIALOG
                ' Dialog coloring
                LB.lbStyle = %BS_SOLID
                LB.lbColor = RGB(158,202,245)
                hBrushDlg  = CreateBrushIndirect(LB)
     
            CASE %WM_CTLCOLORDLG
                ' Return pattern brush
                FUNCTION = hBrushDlg
     
            CASE %WM_DESTROY
                ' We are closing, so delete the brush object
                CALL DeleteObject(hBrushDlg)
        END SELECT
    END FUNCTION

    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    Lance
    mailto:[email protected]

    Comment

    • Scott Turchin
      Member
      • Aug 1998
      • 3171

      #3
      PERFECT!
      Except for one minor obstacle, your RGB gave me baby blue...
      The green I wanted is:
      LB.lbColor = Rgb(60,235,50)


      But, couldn't I just use %GREEN instead of the RGB function??

      Thanks!
      Scott


      ------------------
      Scott Turchin
      MCSE, MCP+I
      Computer Creations Software
      http://www.tngbbs.com/ccs
      Scott Turchin
      MCSE, MCP+I
      http://www.tngbbs.com
      ----------------------
      True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

      Comment

      • Lance Edmonds
        Member
        • Aug 1998
        • 10688

        #4
        You asked for blue...



        ------------------
        Lance
        PowerBASIC Support
        mailto:[email protected][email protected]</A>
        Lance
        mailto:[email protected]

        Comment

        • Lance Edmonds
          Member
          • Aug 1998
          • 10688

          #5
          PS: Regarding the %GREEN question:

          Of course, provided you are referring to the %GREEN equate in WIN32API.INC, as that is a hard-coded RGB value.

          Basically, an RGB value is a LONG or DWORD value that uses the internal format &H0xxBBGGRR, so the RGB function takes only a handful of clock cycles to create the actual value - The RGB function is internal to the compiled PB code; it's not an API function.

          Therefore, the answer is yes: either approach will work fine.

          ------------------
          Lance
          PowerBASIC Support
          mailto:[email protected][email protected]</A>
          Lance
          mailto:[email protected]

          Comment

          • Scott Turchin
            Member
            • Aug 1998
            • 3171

            #6
            Ah, Roger that...
            In fact I am going to make a green.exe (Done) and a red.exe, and a blue.exe

            I am in a Win2k school so for practice I will use this for assigning/publishing with the AD global policy...what fun! (Not!)..

            Thanks Lance, I will post it in the source code forum when I am done.

            Scott

            ------------------
            Scott Turchin
            MCSE, MCP+I
            Computer Creations Software
            http://www.tngbbs.com/ccs
            Scott Turchin
            MCSE, MCP+I
            http://www.tngbbs.com
            ----------------------
            True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

            Comment

            Working...
            X