how to print wide datagrid?
I have a wide datagrid and I would like to print it in landscapge setting. But it always print portrait instead. this is the code I used:
Dim pd As New PrintDocument
AddHandler pd.PrintPage, AddressOf Me.pd_PrintPage
Dim psd As New PageSetupDialog
Dim printerSet As New PrinterSettings
pd.DefaultPageSettings.Landscape = True
printerSet.DefaultPageSettings.Landscape = True
With psd
.AllowMargins = True
.AllowOrientation = True
.AllowPaper = True
.ShowHelp = True
.ShowNetwork = True
.Document = pd
End With
psd.ShowDialog()
Dim myPaintArgs = New PaintEventArgs(e.Graphics, New Rectangle (New Point(0, 0), DataGrid1.Size))
Me.InvokePaint(DataGrid1, myPaintArgs)
pd.Print()
can anybody give me some idea? Thank you!
|