Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Updated 24-Jun-12 3:11am
v2
Comments
Sandeep Mewara 24-Jun-12 4:32am    
Not clear if you are talking of web or winforms here.
Al Yambo 24-Jun-12 9:15am    
Thank you for your inquiry. This is a winform or windows app.

use this in body

HTML
<body bottommargin="10" rightmargin="10" leftmargin="10" topmargin="10">
 
Share this answer
 
Comments
Sandeep Mewara 24-Jun-12 4:31am    
In Winforms?

Not sure if OP asking for web or winforms. If web then ok.
Al Yambo 24-Jun-12 9:14am    
Thank you for your response. This is a winform or windows app.
VB
//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)
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900