Announcement

Collapse
No announcement yet.

Graphic background colour

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Dave Biggs
    replied
    'GRAPHIC COLOR' sets the foreground color and optionally the background color for subsequent graphics statements. So we could also use 'PAINT' this way:
    Code:
    CALLBACK FUNCTION cbClick
        LOCAL i AS LONG
         Randomize
         GRAPHIC COLOR RGB(122, INT(255 * RND()) + 1, INT(255 * RND()) + 1), -1
         GRAPHIC PAINT (0, 0)
         FOR i = 1 TO 10
    (Though this way the box borders are now the same as the fill in the graphic control..)

    Leave a comment:


  • Markus Saegesser
    replied
    Thanks, Gösta

    ...but unfortunately, "GRAPHIC COLOR" works only for graphics created after that statement.

    Regards,
    Markus

    Leave a comment:


  • Gösta H. Lovgren-2
    replied
    Originally posted by Markus Saegesser View Post
    Hello everyone

    I ran into a small problem for - which im sure of - exits a simple solution:

    how can I change the background colour of the graphic I added while creating the dialog?
    Give 'Graphic Color %Black, %red ' a try before the REDRAW. (Use any colors)

    ==========================
    "The ultimate result
    of shielding men
    from the effects of folly
    is to fill the world
    with fools."
    Herbert Spencer
    ==========================

    Leave a comment:


  • Markus Saegesser
    replied
    ...from now on, I do use GRAPHIC PAINT.

    Thanks, works like a charm.

    Best Regards,
    Markus

    Leave a comment:


  • Dave Biggs
    replied
    You could use GRAPHIC PAINT..

    Code:
    CALLBACK FUNCTION cbClick
        LOCAL i AS LONG
         Randomize
         GRAPHIC PAINT (0, 0), RGB(122, INT(255 * RND()) + 1, INT(255 * RND()) + 1)
         FOR i = 1 TO 10...etc

    Leave a comment:


  • Markus Saegesser
    started a topic Graphic background colour

    Graphic background colour

    Hello everyone

    I ran into a small problem for - which im sure of - exits a simple solution:

    how can I change the background colour of the graphic I added while creating the dialog?

    here's some test code:
    Code:
    #COMPILE EXE  'PB 9
    #DIM ALL
    
    '------------------------------------------------------------------------------
    'Includes
    '------------------------------------------------------------------------------
    #INCLUDE "WIN32API.INC"
    
    '------------------------------------------------------------------------------
    
    '------------------------------------------------------------------------------
    'Konstanten
    '------------------------------------------------------------------------------
    
    %IDD_frmHanoi        =  101
    %ID_GRAPHIC          =  102
    %ID_btnClick         =  103
    %ID_btnClose         =  104
    
    '------------------------------------------------------------------------------
    
    '------------------------------------------------------------------------------
    'Globale Deklarationen
    '------------------------------------------------------------------------------
    ''Dialoge
    GLOBAL hDlg             AS DWORD
    
    '------------------------------------------------------------------------------
    'Hauptprogramm
    '------------------------------------------------------------------------------
    FUNCTION PBMAIN()
    
        DIALOG NEW 0, "Test", 70, 70, 450, 225, %WS_CAPTION OR %WS_SYSMENU OR %WS_MINIMIZEBOX OR %DS_CENTER OR %DS_3DLOOK, TO hDlg
        DIALOG SET COLOR hDlg, -1, RGB(255,255,255)
    
        CONTROL ADD BUTTON, hDlg, %ID_btnClick, "cl&ick", 350, 50, 40, 20, CALL cbClick
        CONTROL ADD BUTTON, hDlg, %ID_btnClose, "c&lose", 350, 80, 40, 20, CALL cbClose
    
        CONTROL ADD GRAPHIC,  hDlg, %ID_GRAPHIC,"", 5, 5, 300, 215
        GRAPHIC ATTACH hDlg, %ID_GRAPHIC, REDRAW
        GRAPHIC COLOR -1, RGB(255,255,255)
        
        DIALOG SHOW MODAL hDlg
        
    END FUNCTION
    
    '------------------------------------------------------------------------------
    'Callback Funktionen
    '------------------------------------------------------------------------------
    CALLBACK FUNCTION cbClose
        DIALOG END hDlg
    END FUNCTION
    
    '------------------------------------------------------------------------------
    
    CALLBACK FUNCTION cbClick
        LOCAL i AS LONG
         RANDOMIZE
         FOR i = 1 TO 10
            GRAPHIC BOX (50 + 2 * i, 205 - i * 15) - (150 - 2 * i, 220 - i * 15), 20, -1, RGB(122, INT(255 * RND()) + 1, INT(255 * RND()) + 1), 0
         NEXT i
         GRAPHIC REDRAW
    
    END FUNCTION
    
    '------------------------------------------------------------------------------
    Thanks for your help
    Markus
Working...
X