我用vsflexgrid + vsprint控件, 我怎么得到打印的总页数?
解决方案 »
- 得分的帖子得到不是可用分吗
- 帮我看一段代码谢谢了!!
- 求救!!!!!!!!! 我的vc写的ActiveX控件的一个函数的参数数目改变后,在VB中就不能调用了?
- 谁能给出drag方法的使用注意事项和实例
- 两个VB窗体是如何连接
- 谢谢大家的帮助,又有2个新问题:)
- 有对Eurotron MicroCal PM200多功能校验仪编程的兄弟吗? 请支援, 解决再给分.
- 哪有这个按件?就是像PB中的command按钮?
- 一个以前在2K中文服务器上跑的程序我拿到2Ken server上跑时,执行sql语句时老是报字符集不匹配错误,可是sql里面没有中文,数据库是oracl
- (100分)征询能动态加载图片到activereport2和水晶报表的例子!!!!!!!!!!
- WinXP中ActiveX控件的.ocx文件应放在哪个文件夹??
- 求教:VB中的动态创建菜单的问题
还有,能请你发一个vsprint打印vsflexgrid表格的例子给我吗?谢谢。
[email protected]
Dim bOK%, sMsg$
Select Case Tool.Name
Case "zoomout":
VSPrinter1.Zoom = VSPrinter1.Zoom + VSPrinter1.ZoomStep
Case "zoomin":
VSPrinter1.Zoom = VSPrinter1.Zoom - VSPrinter1.ZoomStep
Case "page": '选择纸张设置
VSPrinter1.PrintDialog (pdPageSetup)
With VSPrinter1
.StartDoc
.Zoom = 75 '显示比例
.RenderControl = bsemployee.vg.hwnd '把网格内容传递给vsView显示
.EndDoc ActiveBar21.Bands(1).Tools(0).Caption = " 第 " + Trim(str(.PreviewPage)) + " 页"
ActiveBar21.Bands(1).Tools(1).Caption = " 共 " + Trim(str(.PageCount)) + " 页"
If .PageCount = 1 Then
ActiveBar21.Bands(0).Tools(0).Enabled = True
ActiveBar21.Bands(0).Tools(1).Enabled = True
ActiveBar21.Bands(0).Tools(3).Enabled = False
ActiveBar21.Bands(0).Tools(4).Enabled = False
Else
ActiveBar21.Bands(0).Tools(0).Enabled = True
ActiveBar21.Bands(0).Tools(1).Enabled = True
ActiveBar21.Bands(0).Tools(3).Enabled = False
ActiveBar21.Bands(0).Tools(4).Enabled = True
End If
End With
Case "back": '前页
With VSPrinter1
If .PreviewPage > 1 Then
.PreviewPage = .PreviewPage - 1
If .PreviewPage = 1 Then
ActiveBar21.Bands(0).Tools(4).Enabled = True
ActiveBar21.Bands(0).Tools(3).Enabled = False
ActiveBar21.Bands(1).Tools(0).Caption = " 第 " + Trim(str(.PreviewPage)) + " 页" Else
ActiveBar21.Bands(0).Tools(4).Enabled = True
ActiveBar21.Bands(0).Tools(3).Enabled = True
ActiveBar21.Bands(1).Tools(0).Caption = " 第 " + Trim(str(.PreviewPage)) + " 页"
End If
Else
If .PreviewPage = 1 Then
ActiveBar21.Bands(0).Tools(4).Enabled = True
ActiveBar21.Bands(0).Tools(3).Enabled = False
ActiveBar21.Bands(1).Tools(0).Caption = " 第 " + Trim(str(.PreviewPage)) + " 页"
Else
ActiveBar21.Bands(0).Tools(4).Enabled = True
ActiveBar21.Bands(0).Tools(3).Enabled = True
ActiveBar21.Bands(1).Tools(0).Caption = " 第 " + Trim(str(.PreviewPage)) + " 页"
End If
End If
End With Case "forward": '后页
With VSPrinter1
If .PreviewPage < .PageCount Then
.PreviewPage = .PreviewPage + 1
If .PreviewPage = .PageCount Then
ActiveBar21.Bands(0).Tools(3).Enabled = True
ActiveBar21.Bands(0).Tools(4).Enabled = False
ActiveBar21.Bands(1).Tools(0).Caption = " 第 " + Trim(str(.PreviewPage)) + " 页"
Else
ActiveBar21.Bands(0).Tools(4).Enabled = True
ActiveBar21.Bands(0).Tools(3).Enabled = True
ActiveBar21.Bands(1).Tools(0).Caption = " 第 " + Trim(str(.PreviewPage)) + " 页"
End If
Else
If .PreviewPage = .PageCount Then
ActiveBar21.Bands(0).Tools(3).Enabled = True
ActiveBar21.Bands(0).Tools(4).Enabled = False
ActiveBar21.Bands(1).Tools(0).Caption = " 第 " + Trim(str(.PreviewPage)) + " 页"
Else
ActiveBar21.Bands(0).Tools(4).Enabled = True
ActiveBar21.Bands(0).Tools(3).Enabled = True
ActiveBar21.Bands(1).Tools(0).Caption = " 第 " + Trim(str(.PreviewPage)) + " 页"
End If
End If
End With
Case "print": '打印输出
VSPrinter1.PrintDoc Case "quit": Unload Me
End Select
End Sub
当前页 = " 第 " + Trim(str(.PreviewPage)) + " 页"
总页数 = " 共 " + Trim(str(.PageCount)) + " 页"
因此你如果要在报表上添加总页数是不行的。有个傻方法,你可先提交,提交完成后,PageCount就是总页数了,把它赋值给变量V1,用V1作为总页数,再提交一次。
没办法中的办法。