Device Context

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to draw gradients directly onto my sub-report. The best method
(most flexible and cool) I have found to do that is API-based, so I need the
report's DC. How can I get that?
 
You can do some types of gradiants using code in the On Print event of your
section with code. You may need to change some values if your gradiant gets
too dark.

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Dim intHeight As Integer
Dim lngY As Long
Dim intColorValue As Integer
intHeight = Me.Section(0).Height
For lngY = 1 To intHeight
intColorValue = 255 - (lngY * intHeight / 1000)
Me.ForeColor = RGB(intColorValue, _
intColorValue, intColorValue)
Me.Line (0, lngY)-Step(Me.Width, 0)
Next
End Sub
 
Thanks, Duane. That's what I'm using now, but to do triangular gradients
(that's the more cool thing!), I need the DC.
 
You cannot access the DC for the report. I have repeatedly asked MS to
expose a handle to the Device Context.

If you absolutely must have this level of control over your output then you
will need to save the Report to another format that you would be able to
render yourself, for ex TIFF. Then you would have to Open the printer
yourself, draw the reports contents or your own stuff in whatver order is
required. I do this with Snapshot files in the ReportUtilities project on my
site. It's not pretty but it works perfectly. Look at the code that renders
the report in 1Up, 2Up etc. configurations.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
Back
Top