473,396 Members | 2,111 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 1267

"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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.