Hi all !
I created image
oIm:=tImage():New()
oIm:LoadBmp(cFile)
I want delete BMP from oIm. How do it ?
Hi all !
I created image
oIm:=tImage():New()
oIm:LoadBmp(cFile)
I want delete BMP from oIm. How do it ?
Natter,
if you want to change the image just load load a new one
oIM:SetBmp(cResName) or oIM:ReLoad( cResName, cBmpFile )
if you want to delete the bmp you can destroy the object, just write oIM := nil or you try to load an unexisting image (not tested)
... delete the bmp you can destroy the object, just write oIM := nil or you try to load an unexisting image (not tested)"
I do it. It's not work
try this:
oIm:hbitmap := 0
oIm:Refresh()
Ralph
It's not work
Natter wrote:It's not workMay be:
PalBmpFree( oIm:hBitMap, oIm:hPalette )#include "Fivewin.ch"
FUNCTION MAIN()
LOCAL oDlg, oImg
DEFINE DIALOG oDlg;
SIZE 700, 500
@ 1, 1 IMAGE oImg;
FILE "SFONDO.JPG";
SIZE 200, 200;
ADJUST
@ 0, 1 BUTTON "Save";
ACTION MSGINFO( oImg:SaveImage( "SAVED.JPG", 2 ) )
@ 0, 7 BUTTON "Print";
ACTION PRINT( oImg )
@ 0, 13 BUTTON "Paste";
ACTION ( oImg:LoadFromClipboard(),;
oImg:Refresh() )
@ 0, 19 BUTTON "Load";
ACTION ( oImg:LoadImage( , "GRIGIO.JPG" ),;
oImg:Refresh() )
@ 0, 25 BUTTON "Clear";
ACTION ( PalBmpFree( oImg:hBitMap, oImg:hPalette ),;
oImg:hBitmap := 0,;
oImg:hPalette := 0,;
oImg:cResName := NIL,;
oImg:cBmpFile := NIL,;
oImg:Refresh() )
ACTIVATE DIALOG oDlg;
CENTER
RETURN NIL
STATIC FUNCTION PRINT( oImg )
LOCAL oPrn
PRINT oPrn PREVIEW MODAL
PAGE
oPrn:SayImage( 0, 0, oImg, oPrn:nHorzRes(), oPrn:nVertRes() )
ENDPAGE
ENDPRINT
RETURN NILIt looks like the TImage class needs an End() method.
James
James Bott wrote:It looks like the TImage class needs an End() method.Hi James:
Thank everybody !
@ 0, 25 BUTTON "Clear";
ACTION oImg:hBitmap := 0, ;
oImg:cBmpFile := NIL,;
oImg:Refresh() )
It work right !
It has. TImage is a TBitmap subclass, then inherits Destroy Method.
Natter,
Try calling oImg:End() or oImg:Destroy() to see if one of those also works.
James
1) calling oImg:End() - this method deleted control
2) calling oImg:Destroy() - this method not work right.
Natter wrote:Thank everybody !
@ 0, 25 BUTTON "Clear";
ACTION oImg:hBitmap := 0, ;
oImg:cBmpFile := NIL,;
oImg:Refresh() )
It work right !