Rounded corners to Text Boxes in MS Access

D

Duane Hookom

Here is code that you can place in a module and call from an event in a
report. You can call it like:
Private Sub Report_Page()
RoundCornerBox Me.Width - 200, 13000, 100, 100, 300, Me, 8
End Sub

Sub RoundCornerBox( _
lngWidth As Long, _
lngHeight As Long, _
lngTop As Long, _
lngLeft As Long, _
lngRadius As Long, _
rptReport As Report, _
Optional intLineWeight As Integer = 1)
'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
rptReport.DrawWidth = intLineWeight

'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
 
G

Guest

Thanks, Duane. The module works wonderfully well.
Solves a major problem for me.
I just managed to figure out how to use it. Hence, the delay.
- Ashit
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top