boxes with rounded corners

H

Hans

Hi All,

I currently developing an access application and the client wants boxes with
rounded corners in some of the reports.

Can some point me in the right direction to make corners rounded.

Regards

Hans
 
D

Duane Hookom

I have done this in the past using the Line and Circle methods of the report.
This takes a bit of code but I think I have a sample (at work) of a function
to do this. I'll have to check later.
 
M

Marshall Barton

Hans said:
I currently developing an access application and the client wants boxes with
rounded corners in some of the reports.

Can some point me in the right direction to make corners rounded.

If you are using A97 (or earlier) or A2007, then look up the
Line and Circle methods in VBA Help. For A2000 through
A2003, Help was garbled, but the examples were still ok.

The general idea is that you need to use code to draw the
rounded boxes. The kind of code would be something like:

Const PI As Double = 3.14159265359
Const r As Integer = 100 'corner radius in twips

Me.DrawWidth = 15 'line thickness

With Me.Textbox
Me.Line (.Left + r, .Top)-(.Left + .Width - r, .Top)
Me.Line (.Left + r, .Top + .Height)-(.Left + .Width - r,
..Top + .Height)
Me.Line (.Left, .Top + r)-(.Left, .Top + .Height - r)
Me.Line (.Left + .Width, .Top + r)-(.Left + .Width, .Top
+ .Height - r)

Me.Circle (.Left + r, .Top + r), r, , 0.5 * PI, 1 * PI
Me.Circle (.Left + .Width - r, .Top + r), r, , 0 * PI,
0.5 * PI
Me.Circle (.Left + r, .Top + .Height - r), r, , 1 * PI,
1.5 * PI
Me.Circle (.Left + .Width - r, .Top + .Height - r), r, ,
1.5 * PI, 2 * PI
End With

If you are doing that for several text boxes, put the above
codea Sub procedure with an argument for the text box
control. Then call the procedure for each text box.
 
H

Hans

Hi Duane,

thnaks for the link, looks great. How do you sharpen/smooth the curves.

Hans
 
D

Duane Hookom

If you want to change the radius of the corners, you will need to modify the
code that draws the quarter circles. This will also require changes in the
Line methods that draw the vertical and horizontal lines.
 
H

Hans

Hi Duane,

Nice bit of code, got it working fine.

I have setup a report with a subreport, the header of the main report
contains 2 boxes with client data in the relevant boxes. The footer contains
another box containing notes and signature details.

In my details section of the main report I have setup a rounded corner box,
with in the details section I also have a subreport printing items ordered.

When I preview the report, page 1 of 2 looks fine both header and footer
display correctly. On page 2 of 2 the box in the main report details section
disappears. what am i missing when a second page is produced.

Regards

Hans
 
D

Duane Hookom

I don't know what event of the report you are using to call the code to draw
the box. Can you provide a little more information about your report?
 
H

Hans

Hi Duane,

sorry for delay in getting back to you.

What i have done is created a report, labelled 'delivery note' with a
subreport labelled 'delivery note details'.

On the main report :-
- page header section (on format), I have define 2 curved corner boxes.
- details section (on format), I have define 1 curved corner box to provide
a border to the subreport place in this section.
- page footer section (on format), I have define 1 curved corner box.

When I run the report, all page 1 of 1 appears correctly with all curved
boxes in the correct position. But when the subreport forces a next page
(page 2 of 2), my boxes in the header and footer show correctly, but in the
main section no curved box shows up when in print preview or printed out.

I have move the code to the on print section within details but no joy. How
should the 'RoundCornerBox' be place so is consistant on all page.

Regards

Hans
 
D

Duane Hookom

I would probably leave the procedure call in the on format of the detail
section. I'm not sure how this will render if the subreport expands to the
second page.

If all of the boxes appear in the same place on every page, you could make
calls to the procedure in the On Page event.
 
H

Hans

Hi Duane,

Did not work.

All reports which consist of one page only seem to work fine. Its when the
the subreport expands to the second page thats causing the problem. The
curved box in the details section of the main report disappears.

Hans
 
D

Duane Hookom

If you use the On Page event, the locations and dimensions would need to be
changed to reflect the page location, not the section location.
 
H

Hans

Hi Duane,

After playing around with the values, got it to work great in the on page
event.

Thanks for the input.

Hans
 

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

Similar Threads


Top