home *** CD-ROM | disk | FTP | other *** search
/ BUG 4 / BUGCD1997_05.BIN / aplic / clip4win / clip4win.exe / C4W30E.HUF / SOURCE / BITMAP.PRG < prev    next >
Text File  |  1994-06-20  |  1KB  |  48 lines

  1. /////////////////////////
  2. //
  3. //    bitmap.prg - draw a bitmap
  4. //
  5. //    Written by:    John M. Skelton, 17-Jun-94.
  6. //
  7. //    Copyright (C) 1994 Skelton Software, Kendal Cottage, Hillam, Leeds LS25 5HP, UK.
  8. //    All Rights Reserved.
  9. //
  10. //
  11. //    NOTE: You may find source\winapi\ files useful (e.g. drawbmp.prg).
  12. //
  13. /////////////////////////
  14.  
  15.  
  16. #include "windows.ch"
  17. #include "inkey.ch"
  18.  
  19.  
  20. function start()
  21. local    hWnd := WinSetup("test", "test")
  22. local    hDC, nEvent, acDIB, cFile
  23.  
  24. HideCaret(hWnd)
  25. ? ; ? "  Press ESC..."
  26. do while (nEvent := ChkEvent()) != EVENT_QUIT
  27.     if nEvent == EVENT_REDRAW
  28.         hDC := GetDC(hWnd)
  29.         if acDIB != nil
  30.             ShowDIB(hDC, acDIB)
  31.             StretchDIBits(hDC,            ;
  32.                       300, 0, 200, 200,        ;
  33.                        , , , ,            ;
  34.                        , acDIB)
  35.         endif
  36.         ReleaseDC(hWnd, hDC)
  37.     elseif nEvent == EVENT_KEY .and. inkey(0) == K_ESC
  38.         cFile := GetOpenFileName(hWnd, "*.bmp", "Select a bitmap")
  39.         if cFile != nil
  40.             acDIB := ReadDIB(cFile)
  41.             InvalidateRect(hWnd)
  42.         endif
  43.     endif
  44. enddo
  45.  
  46. return 0
  47.  
  48.