How to draw a line above a picture?

2019-07-12 14:06发布

问题:

How do you display a line above a picture in Crystal Reports? I'm currently using Crystal Reports 8.5.

I am using a jpeg image in the report, with an image header section set to “Underlay Following sections”.

I added another header above the image header section, drew the line, and then gave the option “underlay following sections”, but the line is not displaying above the picture.

How can I add a line that will display above the picture?

回答1:

If I understand your question, you want to add a line to an image in Crystal Report. Unfortunately, you won't be able to do this with Crystal Reports. Your best option is simply to draw a line above the image. If there is an issue with placement of the line, add another section above the section that contains the image.



回答2:

There's a developer-provided workaround here, using textboxes: http://scn.sap.com/thread/1916479

  1. Insert a text object and enter nothing.
  2. Change the size (the height matches the line width) and background (background color matches the line color).
  3. Right click on the text object and select Move | To Front. And then the "line" will be on top of the picture.

Unforunately, using Crystal Reports 2008, this would only allow me to shrink the textbox to a certain height (0.042 inches), which was still too big for a 1-pixel line.



回答3:

A little late response, but this CodeProject answer works. I had the same problem and this workaround did the trick. I quote the answer here.

  1. Create 2 separate reports. The 1st report will be the main report and the 2nd will be a subreport.
  2. Place all page headers and footers on the main report.

(Main Report)

  1. Right click on the PageHeaderSection and insert section below.
  2. On the new PageHeaderSection, insert the image(your watermark) and set the section to Underlay Following Sections.

(Subreport)

  1. Go to your subreport and place your data and lines on it.

(Main Report)

  1. Again, right click on the PageHeaderSection and insert section below.
  2. On the new PageHeaderSection, right click, Insert->Subreport
  3. Select Choose a Crystal Report in a project, then click the 2nd report you've created. Voila! The lines will be now on the top of the image! Just be sure to remove the borders of your subreport.


回答4:

I've never tried to do this before now, but it appears that the Z order functions (under the Move menu- to back, to front, etc...) are not available for lines or images and it appears that the image z order is always above the line even if you have multiple sections and use the "underlay following sections" option.

My answer is that this can not be done the way you are trying to do it, but what if you try another way.

EDIT: I'm assuming that you are trying to create a strike through in the image in certain instances. Assuming that, you should be able to have 2 images (one normal and one with the line through it) that you should then be able to dynamically change based on you're criteria. You should be able to find many articles on dynamically changing the Crystal Report image. Hope this helps.



回答5:

What worked for me was to create a subreport that essentially duplicates/replaces the Details. Then the usual process of putting the image in the page header and underlaying following sections. The subreport, including its lines, appear above the watermark for me, but please note I'm using Crystal XI.



回答6:

an easy way I added a line is:

  1. add a text box (length of the line you want)
  2. right click -> format text
  3. click on the tab border
  4. select either top or bottom border, the line style etc etc


回答7:

If I understand your question correctly - In the header section, use the line tool to draw the line. It's in the CR Toolbox. Then drag your image after the line.