473,472 Members | 1,727 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Help me to finish my complet Datagrid print

I have just a problem to margin the Datagrid... Could someone help me ?
the datragid always print in the top LEFT
#Region " Impression "

'Déclaration
Private PrintPageSettings As New
System.Drawing.Printing.PageSettings

Private Sub mnItemImprimer_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles mnItemImprimer.Click
printDirect()
End Sub

Private Sub mnItemApercu_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles mnItemApercu.Click
printPreview()
End Sub

Private Sub mnItemMiseEnPage_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles mnItemMiseEnPage.Click
printPageSetup()
End Sub

Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object,
ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles
PrintDocument1.PrintPage
Try
Dim myArgs As New PaintEventArgs(e.Graphics, New
Rectangle(New Point(0, 0), Me.Size))
Select Case Me.ActiveMdiChild.Name
Case "boitesAuxLettres"

Me.InvokePaint(myForms.formBoitesAuxLettres.EasyDa taGrid1, myArgs)
End Select
Catch ex As Exception
monErreur(ex)
End Try

End Sub

Private Sub printDirect()
PrintDocument1.Print()
End Sub

Private Sub printPreview()
Try
PrintDocument1.DefaultPageSettings = PrintPageSettings
PrintPreviewDialog1.Document = PrintDocument1
PrintPreviewDialog1.ShowDialog()
Catch ex As Exception
monErreur(ex)
End Try
End Sub
Private Sub printPageSetup()
Try
PageSetupDialog1.PageSettings = PrintPageSettings
Dim Result1 As DialogResult = PageSetupDialog1.ShowDialog()
If Result1 = DialogResult.OK Then
'To Print
Try

PrintDocument1.DefaultPageSettings =
PrintPageSettings

PrintDialog1.Document = PrintDocument1
Dim Result As DialogResult =
PrintDialog1.ShowDialog
If Result = DialogResult.OK Then
PrintDocument1.Print()
End If
Catch ex As Exception
monErreur(ex)
End Try
End If
Catch ex As Exception
monErreur(ex)
End Try


End Sub
#End Region

Nov 21 '05 #1
1 1269

"ucasesoftware" <uc***********@hotmail.fr> schrieb im Newsbeitrag
news:11**********************@g49g2000cwa.googlegr oups.com...
I have just a problem to margin the Datagrid... Could someone help me ?
the datragid always print in the top LEFT
Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object,
ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles
PrintDocument1.PrintPage
Try
Dim myArgs As New PaintEventArgs(e.Graphics, New
Rectangle(New Point(0, 0), Me.Size))
Select Case Me.ActiveMdiChild.Name
Case "boitesAuxLettres"

Me.InvokePaint(myForms.formBoitesAuxLettres.EasyDa taGrid1, myArgs)
End Select
Catch ex As Exception
monErreur(ex)
End Try

End Sub

Hi,

i am not so sure, but i think you can set the margin like this:

Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object,
ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles
PrintDocument1.PrintPage
e.PageSettings.Margins.Bottom = 100 'and so on ....
e.PageSettings.Margins.Top = 100

end sub
Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: MJay | last post by:
can someone provide me some codes that can print out a datagrid after i have loaded the datagrid with records in a DataTable?
17
by: A_PK | last post by:
I have problem databinding the DataGrid with DataView/DataSet after the filter... I create the following proceudre in order for user to filter as many as they want, but the following code is only...
0
by: ucasesoftware | last post by:
I have just a problem to margin the Datagrid... Could someone help me ? the datragid always print in the top LEFT #Region " Impression " 'Déclaration Private PrintPageSettings As New...
4
by: Jeff User | last post by:
Hi I tryed to solve this problem over in the framework.asp group, but still am having trouble. Hope someone here can help. using .net 1.1, VS 2003 and C# I have an asp.DataGrid control with a...
1
by: simonalexander | last post by:
I have got a homework task to do and I have started the work but I cannot finish it.Can someone please help me finish the code. The help given is much appreciated. The actual specifications are...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
1
by: Peniel | last post by:
Please If any one of you know how to write code which will test the safe sequency i.e code that express Banker's algorithm The pseudocode is as folows  Step1: Let Work and Finish be vectors of...
13
by: icarus | last post by:
Hi all, i'm new to python. Learning on my own how to ask a user to finish a loop or not. For some reason, it behaves as infinite loop although I changed its condition. Please tell me what I'm...
12
by: sheldonlg | last post by:
Here is my situation. I am coding in an AJAX framework for an intranet application behind a vpn. Therefore, I can't give you a URL for the actual app. I made a sample app for viewing and am...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.