SendGDIPlusImage Property
Specifies whether the ReportListener will be passed a handle to the image source when the image is loaded by an object reference or from a General field. Does not apply to images loaded by filename.
ReportListener.SendGDIPlusImage Property [= iExpr]
Return Value
Integer data type.
Note that the property is set to integer type, not logical, to allow for the possibility that a derived class might use other integer values to represent providing the image in other ways besides a graphics handle. For example, a derived class might recognize a value of 2 to indicate "load all file-based images from their original files, and copy them to a different location or different format."
The following lists the values for iExpr recognized by the baseclass ReportListener.
- 0 or any negative integer value
(0 is Default) The ReportListener baseclass does not provide a handle to GDI+ images to derived classes in the Render method.
- 1 and higher integer values
The ReportListener baseclass provides a handle to GDI+ images to derived classes in the Render method.
Remarks
Applies To: ReportListener Object.
This property value has no meaning for baseclass ReportListener objects; it has no effect on native print and preview rendering capabilities. However, ReportListeners providing other types of output can set the property to 1 and receive a handle to the graphics object representing rendered images that come from General fields or the PictureVal property of an Image control, rather than file-based sources.
By default, for performance reasons, this information is not provided to derived classes.
Tip
When you have a reference to a GDI+ graphics handle, you use the GDI+ API to manipulate it. Visual FoxPro ships with a number of Foundation Classes designed to make working with the GDI+ API easier to use. For more information, see GDI Plus API Wrapper Foundation Classes.
This property value does not affect the ReportListener's handling of file-based images. Derived classes receive the appropriate filename as an argument to the Render method, so no other handle is required.
Example
The following code fragment, showing three ReportListener methods, is similar to the internal methods of the XMLDisplayListener derived class. See ReportListener XML Display-Style Foundation Class for more information about this class and how it handles images.
In the BeforeReport event, the code in this example saves the current value of the SendGDIPlusImage. Then it checks to see if the report contains any General fields. If it finds any references to images in the layout information, it sets SendGDIPlusImage to 1 for the duration of the report.
#DEFINE LISTENER_SEND_GDI_IMAGE_HANDLE 1
PROCEDURE BeforeReport()
THIS.oldSendGDIPlusImage = THIS.SendGDIPlusImage
IF (THIS.SendGDIPlusImage < LISTENER_SEND_GDI_IMAGE_HANDLE) ;
AND THIS.checkReportForGeneralFields()
THIS.SendGDIPlusImage = LISTENER_SEND_GDI_IMAGE_HANDLE
ENDIF
DODEFAULT()
ENDPROC
PROCEDURE checkReportForGeneralFields()
LOCAL liGeneralFields, llOpened
THIS.SetFRXDataSession()
IF USED("FRX")
* check,because
* the method might be called
* in the LoadReport() as well as BeforeReport()
SELECT FRX
ELSE
USE (THIS.CommandClauses.File) SHARED NOUPDATE ALIAS FRX IN 0
SELECT FRX
llOpened = .T.
ENDIF
COUNT FOR ObjType = FRX_OBJTYP_PICTURE AND ;
Offset = FRX_PICTURE_SOURCE_GENERAL TO ;
liGeneralFields
IF llOpened
USE IN FRX
ENDIF
THIS.SetCurrentDataSession()
RETURN ( liGeneralFields > 0 )
ENDPROC
PROCEDURE AfterReport()
DODEFAULT()
THIS.SendGDIPlusImage = THIS.oldSendGDIPlusImage
ENDPROC
See Also
Tasks
How to: Add Pictures to Reports
Reference
Render Method
GDIPlusGraphics Property
PictureVal Property
Other Resources
Properties (Visual FoxPro)
Language Reference (Visual FoxPro)