home *** CD-ROM | disk | FTP | other *** search
/ BUG 4 / BUGCD1997_05.BIN / aplic / clip4win / clip4win.exe / C4W30E.HUF / SOURCE / COLOUR.PRG < prev    next >
Text File  |  1992-10-15  |  1KB  |  49 lines

  1. ////////////////////////////
  2. //
  3. //    Clip-4-Win colour demo
  4. //
  5. //    Copyright (C) 1992 Skelton Software, Kendal Cottage, Hillam, Leeds, UK.
  6. //    All Rights Reserved.
  7. //
  8. //
  9. //    Compile:    colour /n /w
  10. //    Link:        /se:600 colour winsetup,,,,clip4win.def
  11. //
  12. ////////////////////////////
  13.  
  14.  
  15. #include "windows.ch"
  16.  
  17.  
  18. static    hWnd, hInst, hPrevInst, nCmdShow
  19. static    cAppName := "Clip-4-Win"
  20.  
  21.  
  22. function main()
  23. local    ev, nColour, hDC, hBrush
  24.  
  25. hWnd = WinSetup(cAppName, "Clip-4-Win colour demo")
  26. hInst = _GetInstance()
  27.  
  28. do while .t.
  29.     do while (ev := ChkEvent()) == EVENT_NONE
  30.     enddo
  31.  
  32.     do case
  33.     case ev == EVENT_REDRAW
  34.     SetPos(0, 0)
  35.     ? ; ? "  Press a key to choose a colour (or 'color')..."
  36.     case ev == EVENT_KEY
  37.     nColour = ChooseColor()
  38.     if nColour >= 0        // else user chose cancel/close or hit Esc
  39.         hDC = GetDC(hWnd)
  40.         hBrush = CreateHatchBrush(HS_DIAGCROSS, nColour)
  41.         FillRect(hDC, 100, 100, 500, 300, hBrush)
  42.         DeleteObject(hBrush)
  43.         ReleaseDC(hWnd, hDC)
  44.     endif
  45.     endcase
  46. enddo
  47.  
  48. return 0
  49.