看MSDN中关于DataEnvironment的部分。
解决方案 »
- 求解决方法!多谢大家!
- vb中如何快速把一个Collection集合保存为文件
- 关于数据库设计的人员离职管理(你们都会碰到哦!!!)
- 請問:怎樣在vb裡面編程來控件攝像頭拍照呢?
- 有好的点子解决FORM中填写大量文本眶的问题吗?
- 求救,關於TreeView的問題,它提未我 Invilad Object
- 很久就想提这样一个问题了
- textbox控件如何保存文件?
- LISTVIEW的一个小问题,放50分相送。
- TreeView如何判断点击的是父结点还是子结点,如何判断是左键点还是右键点?
- 有关测试SQL Server数据库的连通状态的一些疑问
- 请教一个问题,我想编写一个函数。就是在文本框中输入文字的时候。能够自动换行!请问如何实现?
主 题: 请问用什么控件来做打印预览呢? http://www.wzjcw.net/vbgood/code/index.asp?action=read& id=1199
一个网友设计的打印预览类和示例,堪称精品! (有详细的中文注释)
(录入时间:2001.12.22 阅读次数:559) 推荐 转载不详
作者:不详
所属类别:打印
允许环境:VB6.0+Win98
内容介绍:暂时没有这代码的摘要
下载地址:请点这里
注意事项:如下载链接错误,请到论坛 [意见建议] 中报告,谢谢!
http://www.wzjcw.net/vbgood/code/index.asp?action=read& id=173
如何使用VB实现打印预览
http://www.wzjcw.net/vbgood/code/index.asp?action=read& id=25
打印预览
DataReport对象是一个可编程对象,代表数据报表设计器(Data Report designer)。语法DataReport说明Data Report使用数据库中的记录生成报表。要使用它: 配置一个数据源,例如Microsoft数据环境,以访问数据库。
设定DataReport对象的DataSource属性为数据源。
设定DataReport对象的DataMember属性为数据成员。
右键单击设计器,并单击“检索结构”。
向相应的节添加相应的控件。
为每一个控件设定DataMember和DataField属性。
运行时,使用Show方法显示数据报表。
使用DataReport对象通过更改每一Section对象的布局,来编程改变数据报表的外观和行为。数据报表设计器还有使用ExportReport方法导出报表的功能。这一方法允许从ExportFormats集合中指定一个ExportFormat对象,以用作报表的模板。
Private Sub sscmdOK_Click(Index As Integer)
Dim sqlprint As String
Dim J As Integer
Dim XX As String
Dim bb As Integer
sqlprint = "SELECT * FROM Jc_Shhy WHERE hth='" & Trim(W_Jc_Shhy.Text1(0).Text) & "'"
ReportPrint "com_jc_shhy", sqlprint, Dr_Jc_Shhy1
DE_Report.Con_report.Close
OpenDEConnection
'打印选择
If SSOption1(0).Value = True Then '正文
ReportPrint "com_jc_shhy", sqlprint, Dr_Jc_Shhy1
Call TaoPrint(Dr_Jc_Shhy1, nPrintMode)
If W_Jc_Shhy.Text1(9).Text = "TO BE COVERED BY THE BUYERS." Then
Dr_Jc_Shhy1.Sections(3).Controls("label46").Visible = True
Dr_Jc_Shhy1.Sections(3).Controls("Label47").Visible = True
Dr_Jc_Shhy1.Sections(3).Controls("Label48").Visible = True
Dr_Jc_Shhy1.Sections(3).Controls("Label49").Visible = True
Else
Dr_Jc_Shhy1.Sections(3).Controls("Label46").Visible = False
Dr_Jc_Shhy1.Sections(3).Controls("Label47").Visible = False
Dr_Jc_Shhy1.Sections(3).Controls("Label48").Visible = False
Dr_Jc_Shhy1.Sections(3).Controls("Label49").Visible = False
End If
Dr_Jc_Shhy1.Show 1
Else
If SSOption1(1).Value = True Then '附页
XX = mmLine(Rs_Jc_Shhy.Fields("addpage"))
ReportPrint "com_jc_shhy", sqlprint, Dr_Jc_Shhy2
Call TaoPrint(Dr_Jc_Shhy2, nPrintMode)
bb = 1
Dr_Jc_Shhy2.Sections(3).Controls("LABEL2").Caption = bb
Dr_Jc_Shhy2.Show 1
If XX > 53 Then
bb = 2
For I = 1 To Int(XX / 53)
ReportPrint "com_jc_shhy", sqlprint, Dr_Jc_Shhy2
Dr_Jc_Shhy2.Sections(3).Controls("TXTaddpage").Visible = False
Dr_Jc_Shhy2.Sections(3).Controls("LABEL23").Caption = ""
For J = I * 53 + 1 To (I + 1) * 53
Dr_Jc_Shhy2.Sections(3).Controls("LABEL23").Caption = Dr_Jc_Shhy2.Sections(3).Controls("LABEL23").Caption & Mline(Rs_Jc_Shhy.Fields("addpage"), J) & Chr(10) & Chr(13)
Next J
Dr_Jc_Shhy2.Sections(3).Controls("LABEL23").Visible = True
Dr_Jc_Shhy2.Sections(3).Controls("LABEL2").Caption = bb
Dr_Jc_Shhy2.Show 1
bb = bb + 1
Next I
End If
Else
If SSOption1(2).Value = True Then '背面
ReportPrint "com_jc_shhy", sqlprint, Dr_Jc_Shhy3
Call TaoPrint(Dr_Jc_Shhy3, nPrintMode)
Dr_Jc_Shhy3.Show 1
End If
End If
End If
Unload Me
End Sub