Click here to Skip to main content
Sign Up to vote bad
good
See more: C#
My page margins top and bottom are not what is entered in Page Setup dialogue box. The left, right margins are ok, but the top, bottom margins are all over the place.
Thanks in advance for your help. I am using the page setup tool from the visual studio toolbox.
 
This one works ok.
MypageSetupDialog.PageSettings.Margins = new Margins(40, 40, 40, 40);
 
But when I change to this
MypageSetupDialog.PageSettings.Margins = new Margins(100, 100, 100, 100);
The bottom margin is more than 1 inch.
Posted 23 Jun '12 - 13:43
Edited 24 Jun '12 - 3:11

Comments
Sandeep Mewara - 24 Jun '12 - 4:32
Not clear if you are talking of web or winforms here.
Al Yambo - 24 Jun '12 - 9:15
Thank you for your inquiry. This is a winform or windows app.

2 solutions

//In the DrawRows method here is the code that checks for end of page
 
// Checking if the CurrentY is exceeds the page boundries
// If so then exit the function and returning true meaning another
// PagePrint action is required
if ((int)CurrentY > (PageHeight - TopMargin - BottomMargin))
{
CurrentRow++;
return true;
}
 
//should be
if ((int)CurrentY > (PageHeight - BottomMargin))
// otherwise the bottom margin is doubled (if the same as top margin)
  Permalink  
use this in body
 
<body bottommargin="10" rightmargin="10" leftmargin="10" topmargin="10">
  Permalink  
Comments
Sandeep Mewara - 24 Jun '12 - 4:31
In Winforms? Not sure if OP asking for web or winforms. If web then ok.
Al Yambo - 24 Jun '12 - 9:14
Thank you for your response. This is a winform or windows app.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 586
1 Maciej Los 255
2 Slacker007 240
3 Aarti Meswania 233
4 OriginalGriff 230
0 Sergey Alexandrovich Kryukov 9,118
1 OriginalGriff 7,134
2 CPallini 3,803
3 Rohan Leuva 3,135
4 Maciej Los 2,558


Advertise | Privacy | Mobile
Web03 | 2.6.130516.1 | Last Updated 16 Nov 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid