![]() |
|
[VB.NET] طباعة ال data grid view - نسخة قابلة للطباعة +- منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب (http://vb4arb.com/vb) +-- قسم : قسم قواعد البيانات (http://vb4arb.com/vb/forumdisplay.php?fid=40) +--- قسم : قسم اسئلة التقارير والطباعة تحت بيئة الـ.NET (http://vb4arb.com/vb/forumdisplay.php?fid=71) +--- الموضوع : [VB.NET] طباعة ال data grid view (/showthread.php?tid=359) |
طباعة ال data grid view - fatat - 02-10-13 عملت كود لطباعة ال grid view لكن المشكلة انو ما بطبعلي البيانات اللي داخله وكذلك اذا في طريقة تطبعي كل ال grid view في صفحة واحده لانو بيعطيني اياه في اكثر من صفحة كونو الاعمدة اللي فيه عددها كبير كود زر معاينة قبل الطباعة هو كالتالي : Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click If (SetupThePrinting()) Then Dim MyPrintPreviewDialog As PrintPreviewDialog MyPrintPreviewDialog = New PrintPreviewDialog() MyPrintPreviewDialog.Document = PrintDocument1 MyPrintPreviewDialog.ShowDialog() End If End Sub "****************************************** Private Sub PrintDocument1_PrintPage1(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage Dim more As Boolean more = MyDataGridViewPrinter.DrawDataGridView(e.Graphics) If more = True Then e.HasMorePages = True End If End Sub "************************************************** Private Function SetupThePrinting() As Boolean Dim MyPrintDialog As New PrintDialog() MyPrintDialog.AllowCurrentPage = False MyPrintDialog.AllowPrintToFile = False MyPrintDialog.AllowSelection = False MyPrintDialog.AllowSomePages = False MyPrintDialog.PrintToFile = False MyPrintDialog.ShowHelp = False MyPrintDialog.ShowNetwork = False If MyPrintDialog.ShowDialog() <> DialogResult.OK Then Return False End If PrintDocument1.DocumentName = "الجرد السنوي" PrintDocument1.PrinterSettings = MyPrintDialog.PrinterSettings PrintDocument1.DefaultPageSettings = MyPrintDialog.PrinterSettings.DefaultPageSettings PrintDocument1.DefaultPageSettings.Margins = New Margins(40, 40, 40, 40) If MessageBox.Show("Do you want the report to be centered on the page", "InvoiceManager - Center on Page", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = DialogResult.Yes Then MyDataGridViewPrinter = New DataGridViewPrinter(DataGridView1, PrintDocument1, True, True, "معلومات المرضى", New Font("Tahoma", 18, FontStyle.Bold, GraphicsUnit.Point), _ Color.Black, True) Else MyDataGridViewPrinter = New DataGridViewPrinter(DataGridView1, PrintDocument1, False, True, "معلومات المرضى", New Font("Tahoma", 18, FontStyle.Bold, GraphicsUnit.Point), _ Color.Black, True) End If Return True End Function "*************************************************** RE: طباعة ال data grid view - fatat - 03-10-13 ما في حد عندو رد لهالموضوع RE: طباعة ال data grid view - Reyad kha - 01-12-13 http://vb4arb.com/vb/showthread.php?tid=191&pid=1216#pid1216 |