This is a migrated thread and some comments may be shown as answers.

PictureBox - List

2 Answers 123 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Roger
Top achievements
Rank 1
Roger asked on 24 Feb 2012, 04:32 PM
Hello,

I use a PictureBox to display a dynamic loaded Imagelist (Hardcopyscans) of a Document Manegement System.
Now i need to scale the report automaticaly so it fits the width of the 1st picture in the List.

But i allways got two pages instead of one, because the reportsize seems to be to small for the image.
Or, if i scale up the report size, the image wil be shown to small or does some uggly, scaling - that results in unreadable text.

Also, if i receive a "landscape formated image" the size of the report shuld manage this situation, not cuting off the document in two separate pages.

Right now i use something like this in the NeedDataSource Handler:
if (dicFormat["PageSettigs"] == "Landscape") 
    this.Report.PageSettings.Landscape = true;
else 
    this.Report.PageSettings.Landscape = false;

SizeU u1 =
new SizeU(new Unit(lstImage[0].Width, UnitType.Pixel),
new Unit(lstImage[0].Height, UnitType.Pixel));
this.Report.PageSettings.PaperSize = u1;

The content of the image shuld be printed best in 1:1 size.
Whats the best way to manage this?

2 Answers, 1 is accepted

Sort by
0
Hadib Ahmabi
Top achievements
Rank 1
answered on 24 Feb 2012, 04:58 PM
"But i allways got two pages instead of one, because the reportsize seems to be to small for the image." - Have you taken the margins into account? You should subtract the margins in order to get the usable area. 

About the landscape mode, it seems like you are doing it the right way.
0
Roger
Top achievements
Rank 1
answered on 27 Feb 2012, 10:13 AM

Thanks for the reply,

I finally managed it.
As you thought, the problem was the border of the page.
I had set them to 0 but, there is an additional border of the page that can't be controlled as it seems.

The explicit setting of the PictureBox’s size, the subtraction of a constant offset and the scale-configuration of the PictureBox set to "Stretch" solved the problem for me.



Here the Code:
double dOffset = 2;
Unit uWidth = new Unit(29.7 - dOffset, UnitType.Cm); //A4
Unit uHeight = new Unit(21.0 - dOffset, UnitType.Cm); //A4
 
SizeU u1 = new SizeU(uWidth, uHeight);
this.Report.PageSettings.PaperSize = u1;
 
pictureBox1.Width = uWidth;
pictureBox1.Height = uHeight;
Tags
General Discussions
Asked by
Roger
Top achievements
Rank 1
Answers by
Hadib Ahmabi
Top achievements
Rank 1
Roger
Top achievements
Rank 1
Share this question
or