Re: Loading A Graphic Using CxImage From User Input
- Posted by ghaberek (admin) Jun 23, 2009
- 1340 views
Rather than repainting the image on just part of your window, create a small child window the size of the image you want to display. That small window will receive its own paint events and will "clip" properly.
include Win32Lib.ew without warning constant Main = create( Window, "Test", 0, Default, Default, 640, 480, 0 ) constant PicWin = create( Window, "", Main, 10, 10, 64, 64, {WS_CHILD,WS_VISIBLE} ) procedure PicWin_onPaint( integer pSelf, integer pEvent, sequence pParams ) copyBlt( PicWin, 0, 0, YourImage ) end procedure setHandler( PicWin, w32HPaint, routine_id("PicWin_onPaint") ) WinMain( Main, Normal )
Also, you may need to use transBlt() instead of copyBlt() if you need to preserve the transparent background of your image.
-Greg