Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to obtain the device context in a report???
Message
From
13/05/2005 13:59:58
 
 
To
13/05/2005 12:09:55
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
01013847
Message ID:
01013997
Views:
18
Thanks to Christian and Michael.

The Christian suggestion works GREAT. In the middle i test with the GDI PLUS API WRAPPER FOUNDATION CLASS LIBRARY (_GDIPLUS.VCX) and works OK. Then i found the following problem: ESRI MAP OBJECTS active X render a map to a device context with the following call:

map.outputmap2 ( hdc, left, top, width, height )

where the coordinates defines an rectangle in the DC and i pass the RENDER coordinates. THE MAP APPEARS IN THE PREVIEW BUT TOTALLY OUTSIDE OF THE REPORT, I IMAGINE EXPECTING A COORDINATE TRANSFORMATION. Any sugerence???? The simplified code its:
define class molistener as _reportlistener of home() + "ffc\_reportlistener.vcx"

ogdigraphics = .NULL.

function beforereport
dodefault()
* create an graphic object
this.ogdigraphics = newobject ( "GPGraphics", home() + "ffc\_GDIPlus.vcx" )
endfunc

procedure render ( nfrxrecno, nleft, ntop, nwidth, nheight, ;
                   nobjectcontinuationtype, ccontentstoberendered, ;
                   gdiplusimage )
private ismapobject
private mocommand
private myhdc
* recover report session and look the object
this.setfrxdatasession()
go nfrxrecno in frx
* is an map object?
if frx.objtype = 7 and frx.user = "map" then
  ismapobject = .t.
else
  ismapobject = .f.
endif
* return to the current session
this.setcurrentdatasession()
* execute default render code
dodefault ( nfrxrecno, nleft, ntop, nwidth, nheight, nobjectcontinuationtype, ;
            ccontentstoberendered, gdiplusimage )
* is an map object?
if ismapobject then
  local z, xx as integer
  * obtain handle
  this.ogdigraphics.sethandle ( this.gdiplusgraphics )
  * save graphic status
  this.ogdigraphics.save(@z)
  * get hdc
  myhdc = this.ogdigraphics.gethdc ()
  * render the map (ESRI map objects)
  mapform.map.outputmap2 ( myhdc, nleft, ntop, nwidth, nheight )
  this.ogdigraphics.releasehdc ( myhdc )
  * recover the graphic state
  this.ogdigraphics.restore(z)
endif
endproc
enddefine
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform