vb.bet自带的水晶报表怎么调用?
vb.bet自带的水晶报表怎么调用?直接打印到打印机是这样写的:
程序代码:
Private Sub printgraphicGCxukezheng(ByVal sender As Object, ByVal ev As PrintPageEventArgs) Dim x As Integer Dim y As Integer x = 990 y = 110 ev.Graphics.DrawString(TextBox22.Text, New Font("宋体", 13, FontStyle.Regular), Brushes.Black, 450, 274) ev.Graphics.DrawString(TextBox32.Text, New Font("宋体", 11, FontStyle.Regular), Brushes.Black, x, y) y = y + 46 ev.Graphics.DrawString(TextBox31.Text, New Font("宋体", 11, FontStyle.Regular), Brushes.Black, x, y) y = y + 46 ev.Graphics.DrawString(TextBox25.Text, New Font("宋体", 11, FontStyle.Regular), Brushes.Black, x, y) y = y + 46 ev.Graphics.DrawString(TextBox24.Text, New Font("宋体", 11, FontStyle.Regular), Brushes.Black, x, y) ev.Graphics.DrawString(DateTimePicker2.Text, New Font("宋体", 13, FontStyle.Regular), Brushes.Black, 419, 753) Dim numchars As Integer Dim numlines As Integer Dim stringfopage As String Dim strformat As New StringFormat Dim rectdraw As New RectangleF(820, 325, 530, 245) Dim sizemeasure As New SizeF(543, 170 - printfont.GetHeight(ev.Graphics)) strformat.Trimming = StringTrimming.Word ev.Graphics.MeasureString(stringtoprint, printfont, sizemeasure, strformat, numchars, numlines) stringfopage = stringtoprint.Substring(0, numchars) ev.Graphics.DrawString(stringfopage, printfont, Brushes.Black, rectdraw, strformat) ev.HasMorePages = False End Sub Private Sub Button16_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button16.Click Try PrintDocument1.DefaultPageSettings = printpagesettings stringtoprint = RichTextBox3.Text PrintDialog1.Document = PrintDocument1 PageSetupDialog1.PageSettings = printpagesettings PrintDialog1.ShowDialog() PageSetupDialog1.ShowDialog() AddHandler PrintDocument1.PrintPage, AddressOf Me.printgraphicGCxukezheng PrintDocument1.Print() Catch ex As Exception MessageBox.Show("打印出现错误", ex.ToString()) End Try End Sub
可不知道VB自带的水晶报表怎么去打印,请高人指点
问题二:怎么在代码里设置页面设置?如:纸张大小、打印方向?