如何打印GridView&的数据Windows窗体中的文本框 [英] How to Print Data of GridView & Textboxes in Windows Forms

查看:57
本文介绍了如何打印GridView&的数据Windows窗体中的文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

How to Print Data of GridView And Textboxes in Windows Forms<br />
Here is the code i tried,but it is taking screenshot but not able to print Scrollable Data:


Private Sub BtnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnPrint.Click
        Try
            If ComboOrderNo.SelectedIndex <> 0 And ComboShift.SelectedIndex <> 0 And TxtFromDate.Text <> "" And TxtToDate.Text <> "" Then
                Dim Printer = New DGVPrinter
                Printer.Title = "BOX HARDNESS ACCEPT REPORT"
                ''Before printing, hide all Buttons
                Dim ctl As Control
                For Each ctl In Me.Controls
                    If ctl.GetType.FullName = "System.Windows.Forms.Button" Then
                        ctl.Visible = False
                    End If
                Next
                ''Before printing, set Form.BackColor as White
                Dim FormBackColor As Color = Me.BackColor
                Me.BackColor = System.Drawing.Color.White
                Me.Refresh()
                ''Printing the form
                Dim PF As New Microsoft.VisualBasic.PowerPacks.Printing.PrintForm
                PF.Print(Me, PowerPacks.Printing.PrintForm.PrintOption.Scrollable)
                ''After printing, restore settings
                For Each ctl In Me.Controls
                    If ctl.GetType.FullName = "System.Windows.Forms.Button" Then
                        ctl.Visible = True
                    End If
                Next
                Me.BackColor = FormBackColor
            ElseIf ComboOrderNo.SelectedIndex = 0 Then
                MessageBox.Show("SELECT ORDERNO")
            ElseIf ComboShift.SelectedIndex = 0 Then
                MessageBox.Show("SELECT SHIFT")
            ElseIf TxtFromDate.Text = "" Or TxtToDate.Text = "" Then
                MessageBox.Show("GAVE FROM DATE/TO DATE")
            End If
        Catch Ex As Exception
            MessageBox.Show(Ex.Message)
        End Try
    End Sub


<br />
Can any one suggest me <br />
<br />
"HOW TO PRINT ''SCROLLABLE DATA IN THE DATAGRIDVIEW'' WITH THE ''TEXTBOXES-DATA'' OUTSIDE THE DATAGRIDVIEW IN WINDOWS APPLICATION"<br />
I have been struggling with this from past 3 days,Please advise....

推荐答案

如果要进行自定义打印,则需要对
If you want to do custom printing, then you need to do some research into the PrintDocument Class (MSDN)[^]. On the link I have provided is a good example of printing in .Net.

Hope this helps


在Visual Basic Power Packs中使用PrintForm组件

PrintForm组件旨在带回轻松打印Windows窗体的功能.这样就可以按照您想要的方式完全布局Windows窗体,并且还可以将窗体作为快速报告打印.



Microsoft Visual Basic Power Packs 3.0下载

[
^ ]
Using PrintForm component in Visual Basic Power Packs

The PrintForm component is designed to bring back the ability to easily print a Windows Form. This makes it possible to layout the Windows Form exactly as you want and also allows you to print the form as a quick report.



Microsoft Visual Basic Power Packs 3.0 Download

[^]
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) 
    Handles Button1.Click
    PrintForm1.Print(Me, PowerPacks.Printing.PrintForm.PrintOption.Scrollable)
End Sub


也许这可以满足您的要求


May this can fulfill your requirement


有关Visual Basic Power Pack的更多信息
访问此链接.您很可能会在那里找到您的解决方案
[
For more Info on Visual Basic power pack
Visit this link .You will be most probably find your solution there
[^]


这篇关于如何打印GridView&amp;的数据Windows窗体中的文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆