In Access Reports, How to draw a rounded rectangle? (as in Excel)

M

Marshall Barton

Michael said:
In Access Reports, How to draw a rounded rectangle?
...as in Excel's Autoshapes


See the thread with subjsect:
Lines - print different to whats on screen
from early yesterday.

It may not be worth the effort.
 
M

Michael

Your are right it is now worth programming

I was wondering if there was a ready-made object like rectangle and line to
draw the rounded rectangle for a presentation purposes.

But since there is none, then I have another method I have used in the past:
- Draw the rounded rectangle, as you would like it, using Excel, with chosen
color, thickness, transparent background, etc.
- Copy it and past into the Access report.
- Change the border and back style to Transparent, and the size mode to
stretch (to change the size in the report)

In Access report, this pasted object is a sizable "picture" with transparent
filling.


Thanks anyway,

Michael
 
M

Marshall Barton

Michael said:
Your are right it is now worth programming

I was wondering if there was a ready-made object like rectangle and line to
draw the rounded rectangle for a presentation purposes.

But since there is none, then I have another method I have used in the past:
- Draw the rounded rectangle, as you would like it, using Excel, with chosen
color, thickness, transparent background, etc.
- Copy it and past into the Access report.
- Change the border and back style to Transparent, and the size mode to
stretch (to change the size in the report)

In Access report, this pasted object is a sizable "picture" with transparent
filling.


Yes, that agrees with Stephen's suggestion in the other
thread.
 
P

Peter Kinsman

Marsh et al

Last evening I decided I needed to print a number of rectangles with some
square corners and some rounded. I offer the following code as a solution
to a problem that is more complicated than your original


Private Sub RoundedRectangle(Top, Left, Height, Width, Radius, _
TR As Boolean, TL As Boolean, BL As Boolean, BR As Boolean)
' The Top, Left, Height, Width and Radius parameters as as in the Circle
function
' The TR, TL, BL and BR parameters make each corner round or square
' If they were changed to numeric, they could allow a different radius at
each corner
' without too much extra coding.
Const conPI = 3.14159265359
' Top right radius
If TR Then Me.Circle (Left + Width - Radius, Top + Radius), Radius, , 0,
conPI / 2
' Top left radius
If TL Then Me.Circle (Left + Radius, Top + Radius), Radius, , conPI / 2,
conPI
' Bottom left radius
If BL Then Me.Circle (Left + Radius, Top + Height - Radius), Radius, ,
conPI, 3 * conPI / 2
' Bottom right radius
If BR Then Me.Circle (Left + Width - Radius, Top + Height - Radius),
Radius, , 3 * conPI / 2, 0
Me.Line (Left + IIf(TL, Radius, 0), Top)-(Left + Width - IIf(TR, Radius,
0), Top)
Me.Line (Left + IIf(BL, Radius, 0), Top + Height)-(Left + Width - IIf(BR,
Radius, 0), Top + Height)
Me.Line (Left, Top + IIf(TL, Radius, 0))-(Left, Top + Height - IIf(BR,
Radius, 0))
Me.Line (Left + Width, Top + IIf(TR, Radius, 0))-(Left + Width, Top +
Height - IIf(BR, Radius, 0))
End Sub

Regards

Peter Kinsman
 
M

Marshall Barton

Peter said:
Last evening I decided I needed to print a number of rectangles with some
square corners and some rounded. I offer the following code as a solution
to a problem that is more complicated than your original


Private Sub RoundedRectangle(Top, Left, Height, Width, Radius, _
TR As Boolean, TL As Boolean, BL As Boolean, BR As Boolean)
' The Top, Left, Height, Width and Radius parameters as as in the Circle
function
' The TR, TL, BL and BR parameters make each corner round or square
' If they were changed to numeric, they could allow a different radius at
each corner
' without too much extra coding.
Const conPI = 3.14159265359
' Top right radius
If TR Then Me.Circle (Left + Width - Radius, Top + Radius), Radius, , 0,
conPI / 2
' Top left radius
If TL Then Me.Circle (Left + Radius, Top + Radius), Radius, , conPI / 2,
conPI
' Bottom left radius
If BL Then Me.Circle (Left + Radius, Top + Height - Radius), Radius, ,
conPI, 3 * conPI / 2
' Bottom right radius
If BR Then Me.Circle (Left + Width - Radius, Top + Height - Radius),
Radius, , 3 * conPI / 2, 0
Me.Line (Left + IIf(TL, Radius, 0), Top)-(Left + Width - IIf(TR, Radius,
0), Top)
Me.Line (Left + IIf(BL, Radius, 0), Top + Height)-(Left + Width - IIf(BR,
Radius, 0), Top + Height)
Me.Line (Left, Top + IIf(TL, Radius, 0))-(Left, Top + Height - IIf(BR,
Radius, 0))
Me.Line (Left + Width, Top + IIf(TR, Radius, 0))-(Left + Width, Top +
Height - IIf(BR, Radius, 0))
End Sub


If you need oddly rounded rectangles, this looks like a good
way to do it. However,

I can't imagine a need for it, but I do like your idea of
making the TR,BL,... arguments type Double. Specifying a
value of 0 would result in a square corner so it would be
very general. However, since the radii are specified by the
caller, I think checking each radius to make sure it is not
greater than the height and width would provide a good
safety factor.
 

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