Click here to Skip to main content
15,880,392 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello experts,

Here is my code where the Print preview functionality works

Private Sub PrintPreviewToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintPreviewToolStripMenuItem.Click, btnPreview.Click
   If printTarget Is Nothing Then
     MessageBox.Show("Please select a target.")
   Else
     Try
       PrintPreviewDialog1.WindowState = FormWindowState.Maximized
       PrintPreviewDialog1.ShowDialog()
     Catch es As Exception
       MessageBox.Show(es.Message)
     End Try
   End If
 End Sub


As my Grid is huge in the forms, it only shows half of the grid. Rest all the grids are absolutely perfect.

Can someone help me please?
Posted
Comments
Afzaal Ahmad Zeeshan 25-Sep-15 10:41am    
Decrease the size. Or use a variable height and width for your Grid.
sudevsu 25-Sep-15 11:05am    
variable height for Grid? Its not about height. Its about Width. I did try changing width sizes and still it is not showing the entire grid.
Afzaal Ahmad Zeeshan 25-Sep-15 11:24am    
Sorry about height, I thought both are causing a trouble.

The thing is same, try using a variable width. Or else create a new Grid for the columns that cannot fit in.
sudevsu 25-Sep-15 11:40am    
Got it. Thank you. However, I did get a solution.

1 solution

VB
PrintDocument1.DefaultPageSettings.Margins.Left = 50
        PrintDocument1.DefaultPageSettings.Landscape = True



This is what I did ... simple yet useful if someone needs.
Just try changing portrait to landscape
 
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