Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
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:43pm
Edited 24-Jun-12 3:11am
v2
Comments
Sandeep Mewara at 24-Jun-12 4:32am
   
Not clear if you are talking of web or winforms here.
Al Yambo at 24-Jun-12 9:15am
   
Thank you for your inquiry. This is a winform or windows app.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

use this in body
 
<body bottommargin="10" rightmargin="10" leftmargin="10" topmargin="10">
  Permalink  
Comments
Sandeep Mewara at 24-Jun-12 4:31am
   
In Winforms?
 
Not sure if OP asking for web or winforms. If web then ok.
Al Yambo at 24-Jun-12 9:14am
   
Thank you for your response. This is a winform or windows app.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

//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  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 853
1 OriginalGriff 410
2 CPallini 275
3 George Jonsson 226
4 Richard Deeming 145
0 OriginalGriff 5,450
1 CPallini 4,500
2 Sergey Alexandrovich Kryukov 4,482
3 George Jonsson 3,057
4 Gihan Liyanage 2,445


Advertise | Privacy | Mobile
Web04 | 2.8.140916.1 | Last Updated 16 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100