Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Line boxes on reports

73 views
Skip to first unread message

Mike Stroud

unread,
May 15, 2002, 2:39:59 AM5/15/02
to
I want to draw a box on a report with rounded corners and
not square for an invoice. Is there a way other than using
a image file.

Duane Hookom

unread,
May 15, 2002, 10:33:23 AM5/15/02
to
You can create a generic function to draw the box using the Report Line and
Circle methods. Copy the following code into a new, blank module and save
the module as "basShapes". I tried to use lots of line continuation
characters but you may need to watch line wrapping.
Then, in any report, you can call the sub to do the work. To draw a box 4000
(twips) by 6000 near the top left corner with a radius of 300 on the current
report, use:

RoundCornerBox 4000, 6000, 100, 200, 300, Me

Sub RoundCornerBox( _
lngWidth As Long, _
lngHeight As Long, _
lngTop As Long, _
lngLeft As Long, _
lngRadius As Long, _
rptReport As Report)
'call this from a report with syntax like
'
'Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
' RoundCornerBox 4000, 6000, 100, 200, 300, Me
'End Sub

Dim sngStart As Single
Dim sngEnd As Single
Dim dblPI As Double
dblPI = 3.14159265359

'Top Left
sngStart = 2 * dblPI * 0.25 ' Start of pie slice.
sngEnd = 2 * dblPI * 0.5 ' End of pie slice.
rptReport.Circle (lngLeft + lngRadius, _
lngTop + lngRadius), _
lngRadius, vbBlue, sngStart, sngEnd
'Top line
rptReport.Line (lngLeft + lngRadius, lngTop)- _
(lngLeft + lngWidth - lngRadius, lngTop)

'Top Right
sngStart = 2 * dblPI * 0.000001
sngEnd = 2 * dblPI * 0.25
rptReport.Circle (lngLeft + lngWidth - _
lngRadius, lngTop + lngRadius), _
lngRadius, vbBlue, sngStart, sngEnd
'right line
rptReport.Line (lngLeft + lngWidth, _
lngTop + lngRadius)- _
(lngLeft + lngWidth, _
lngTop + lngHeight - lngRadius)

'Bottom right
sngStart = 2 * dblPI * 0.75
sngEnd = 2 * dblPI
rptReport.Circle (lngLeft + lngWidth - _
lngRadius, lngTop + lngHeight - lngRadius), _
lngRadius, vbBlue, sngStart, sngEnd
rptReport.Line (lngLeft + lngRadius, _
lngTop + lngHeight)- _
(lngLeft + lngWidth - lngRadius, lngTop + lngHeight)

'Bottom Left
sngStart = 2 * dblPI * 0.5
sngEnd = 2 * dblPI * 0.75
rptReport.Circle (lngLeft + lngRadius, _
lngTop + lngHeight - lngRadius), _
lngRadius, vbBlue, sngStart, sngEnd
'right line
rptReport.Line (lngLeft, lngTop + lngRadius)- _
(lngLeft, lngTop + lngHeight - lngRadius)

End Sub

--
Duane Hookom
Microsoft Access MVP
Please direct any questions to News Groups


"Mike Stroud" <mikest...@hotmail.com> wrote in message
news:34ab01c1fbdb$55996390$a5e62ecf@tkmsftngxa07...

Stephen Lebans

unread,
May 23, 2002, 8:41:04 PM5/23/02
to
Duane I finally got around to trying out your code tonight. Excellent
work!
Copied and saved to my Code folder where in the years to come I will
probably forget you wrote this and take credit myself!<grin>
:-)
--

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


"Duane Hookom" <duane...@mvps.org> wrote in message
news:OHpA51B$BHA.1156@tkmsftngp04...

Duane Hookom

unread,
May 23, 2002, 11:18:51 PM5/23/02
to
That's ok, I have gotten a lot of mileage off your hard work!

--
Duane Hookom
Microsoft Access MVP


"Stephen Lebans" <Stephe...@mvps.org> wrote in message
news:A_fH8.23598$cT2.2...@news-nb00s0.nbnet.nb.ca...

0 new messages