print image from form

hi!

i would like to print image from form

now i create print button in form and here is the click event code

DO [C:\Documents and Settings\sony\My Documents\New Folder (2)\PROGS\printimage.prg]

now here is my printimage.prg code

LPARAMETERS tcImage
tcImage = GETPICT()

LOCAL lnArea
lnArea = SELECT()


CREATE CURSOR ReportTemp (ImageFile c(150))
INSERT INTO ReportTemp VALUES (tcImage)

MakeReport()

SELECT ReportTemp
REPORT FORM ImageReport PREVIEW
DELETE FILE "ImageReport.fr*"
SELECT (lnArea)

RETURN

FUNCTION MakeReport
CREATE REPORT ImageReport FROM ReportTemp

USE ImageReport.FRX IN 0 ALIAS TheReport EXCLUSIVE
SELECT TheReport

DELETE FROM TheReport WHERE ObjType = 5 AND ObjCode = 0 && Remove the Labels
DELETE FROM TheReport WHERE ObjType = 8 AND ObjCode = 0 && Remove the Fields

LOCAL loNewRecObj AS EMPTY
loNewRecObj = NEWOBJECT( 'EMPTY' )
ADDPROPERTY( loNewRecObj, 'PLATFORM', 'WINDOWS' )
ADDPROPERTY( loNewRecObj, 'Uniqueid', SYS(2015) )
ADDPROPERTY( loNewRecObj, 'ObjType', 17 ) && "Picture/OLE Bound Control"
ADDPROPERTY( loNewRecObj, 'NAME', 'ReportTemp.ImageFile' ) && The object ref to the IMAGE object.
ADDPROPERTY( loNewRecObj, 'Hpos', 100)
ADDPROPERTY( loNewRecObj, 'Vpos', 600)
ADDPROPERTY( loNewRecObj, 'HEIGHT', 100000)
ADDPROPERTY( loNewRecObj, 'WIDTH', 100000)
ADDPROPERTY( loNewRecObj, 'DOUBLE', .T. ) && Picture is centered in the "Picture/OLE Bound Control"
ADDPROPERTY( loNewRecObj, 'Supalways', .T. )

ADDPROPERTY( loNewRecObj, 'Offset', 2 )

APPEND BLANK IN TheReport
GATHER NAME loNewRecObj MEMO

PACK MEMO
USE IN SELECT( 'TheReport' )
ENDFUNC

now if i do tcimage=getpict() it open file dilog box an i have to pick image file but want to skip this and get the image from my current record is it possible and how?

[2105 byte] By [NILKAMAL] at [2008-1-4]
# 1

Comment the second line in this procedure (the one with GetPict).

Add this program to your project.

In the Print button put

?PrintImage(alltrim(myTable.Image)) && where Image field has full path to your image file

NaomiNosonovsky at 2007-9-25 > top of Msdn Tech,Visual FoxPro,Visual FoxPro General...