紧急的问题!火烧眉毛了!!!!!!!!!!!!救!!!

tony1980 2002-12-30 07:40:48
怎么在做的MDI窗体中实现像VB那样的工具栏,就是左边的那个的控件栏!
怎么实现打印MSFlexGrid里的内容!
重分感谢
...全文
12 点赞 收藏 10
写回复
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
shawls 2002-12-31
给你一个入坞的例子

http://www.microsoft.com&item=member&login=www.21code.com&passwordhash=1030094917&downloadsrv=china_bjtelcom&file=&+@www.21code.com/codebase/go.php?data=dmJjdHJsL3ZiY3RyL1RhYkRvY2tWMkRvY2tpbmdJbnRlcmZhY2Uuemlw

使你的MDI子窗体能够Dock(又称“入坞”、“连接”,效果就象VB的属性等窗体一样)的控件。在这一版里已经消除了大部分的BUG,并能自动调整Dock窗体的大小
回复
tony1980 2002-12-31
我要的工具栏可以移动和改变大小的
回复
smilejiangjun 2002-12-31
同一是用picture控件放入mdi窗体中,在上面在加一些按钮不就能实现了吗
回复
litsnake1 2002-12-31
up
回复
online 2002-12-31
第一个我可以搞定
online@ourfly.com
回复
tony1980 2002-12-31
Thank you very much!
回复
Arcan 2002-12-30
第一个问题可以使用Picture控件,它可以放入MDI主窗体中,它本身还是一个容器,可以在里面放入各种其他的控件。
或者直接用一个MDI子窗体来做。
回复
chenyu5188 2002-12-30
UP
回复
moongirl77 2002-12-30
楼上的大哥好善良,这么卖力气地解答,狐狼要多给些分数喽!!
该问题已经被我加入收藏夹了。:)
回复
zhenxizhou 2002-12-30
回答你第二个问题。打印MsFlexGrid要自己控制,如写文本、画线等,参考下面程序:

Private Function TblHeader()
Dim i As Integer

MSFlexGrid1.Font.Name = "宋体"
MSFlexGrid1.Font.Size = 12
MSFlexGrid1.FixedRows = 1
MSFlexGrid1.FixedCols = 0
For i = 0 To 5
MSFlexGrid1.ColWidth(i) = 1800
MSFlexGrid1.TextMatrix(0, i) = "第" & Str(i) & "列"
Next i
End Function

Private Sub CmdExit_Click()
End
End Sub

Private Sub CmdPrint_Click()
'根据表格的宽度自动选择打印纸,打印图中所见的表格
Dim X, Y As Integer
Dim PageSize As Integer
Dim PageNum As Integer
Dim TableWidth As Integer
Dim TableHeight As Integer
Dim TableWidthTemp As Integer
Dim TableHeightTemp As Integer
Dim TableName As String
Dim TitleLen As Integer
Dim PageTemp As Integer
Dim TableLeft As Integer
Dim TableTop As Integer

TableName = "数据报表打印演示"
TableLeft = 1000 '纸的左边距
TableTop = 1000 '纸的上边距
PageSize = 0
PageNum = 0
TitleLen = (Len(TableName)) * Printer.FontSize * 20
'累加表格的列宽从而判定表格的宽度
For X = 0 To MSFlexGrid1.Cols - 1
TableWidth = TableWidth + MSFlexGrid1.ColWidth(X)
Next X
'通过获取表格的行数来确定每页打印的行数进行分页打印
For X = 0 To MSFlexGrid1.Rows - 1
TableHeight = TableHeight + MSFlexGrid1.RowHeight(X)
Next X
If TableWidth <= 500 * 20 Then
PageSize = 650 * 20 'A4纵向
Beep
MsgBox "请纵向装好A4打印纸!", vbInformation, "打印信息"
End If
If TableWidth > 500 * 20 And TableWidth <= 660 * 20 Then
PageSize = 1000 * 20 'A3纵向
Beep
MsgBox "请纵向装好A3打印纸!", vbInformation, "打印信息"
End If
If TableWidth > 660 * 20 And TableWidth <= 1050 * 20 Then
PageSize = 610 * 20 'A3横向
Beep
MsgBox "请横向装好A3打印纸!", vbInformation, "打印信息"
End If
If TableWidth > 1050 * 20 Then
Beep
MsgBox "表格超宽,返回!", vbInformation, "打印信息"
Exit Sub
End If
TableWidthTemp = 0
'使用Printer对象的Pset语句实现定位
Printer.PSet (TableLeft + (TableWidth - TitleLen) / 2, TableTop)
Printer.FontSize = 14
'Printer.Print打印文字
Printer.Print TableName
TableTop = TableTop + Printer.FontSize * 20 + 100
'Printer.Line打印表格的直线
Printer.Line (TableLeft, TableTop)-(TableLeft + TableWidth, TableTop)
For Y = 0 To MSFlexGrid1.Cols - 1
TableWidthTemp = TableWidthTemp + MSFlexGrid1.ColWidth(Y)
MSFlexGrid1.Row = 0
MSFlexGrid1.Col = Y
Printer.PSet (TableLeft + (TableWidthTemp - MSFlexGrid1.ColWidth(Y)), TableTop)
Printer.FontSize = 9
Printer.Print MSFlexGrid1.Text
Next Y
TableTop = TableTop + MSFlexGrid1.RowHeight(0)
TableHeightTemp = 0
For PageTemp = 1 To (MSFlexGrid1.Rows - 1)
TableWidthTemp = 0
For Y = 0 To MSFlexGrid1.Cols - 1
TableWidthTemp = TableWidthTemp + MSFlexGrid1.ColWidth(Y)
MSFlexGrid1.Row = PageTemp
MSFlexGrid1.Col = Y
Printer.PSet (TableLeft + (TableWidthTemp - MSFlexGrid1.ColWidth(Y)), TableTop + TableHeightTemp + (MSFlexGrid1.RowHeight(PageTemp) - Printer.FontSize * 20) - 40)
Printer.FontSize = MSFlexGrid1.CellFontSize
Printer.Print MSFlexGrid1.Text
Next Y
TableHeightTemp = TableHeightTemp + MSFlexGrid1.RowHeight(PageTemp)
Printer.Line (TableLeft, TableTop + TableHeightTemp - MSFlexGrid1.RowHeight(PageTemp))-(TableLeft + TableWidth, TableTop + TableHeightTemp - MSFlexGrid1.RowHeight(PageTemp))
If TableHeightTemp + MSFlexGrid1.RowHeight(PageTemp) >= PageSize Then
Printer.Line (TableLeft, TableTop + TableHeightTemp)-(TableLeft + TableWidth, TableTop + TableHeightTemp)
TableWidthTemp = 0
For Y = 0 To MSFlexGrid1.Cols - 1
TableWidthTemp = TableWidthTemp + MSFlexGrid1.ColWidth(Y)
Printer.Line (TableLeft + TableWidthTemp, TableTop - MSFlexGrid1.RowHeight(0))-(TableLeft + TableWidthTemp, TableTop + TableHeightTemp)
Next Y
Printer.Line (TableLeft, TableTop - MSFlexGrid1.RowHeight(0))-(TableLeft, TableTop + TableHeightTemp)
If PageTemp = MSFlexGrid1.Rows - 1 Then
Printer.PSet (TableLeft + (TableWidth - Len("第" + Str$(PageNum) + "页") * FontSize * 20) / 2, TableTop + TableHeightTemp + 80)
PageNum = PageNum + 1
Printer.FontSize = 12
Printer.Print "第"; PageNum; "页"
Printer.EndDoc
Exit Sub
End If
Printer.PSet (TableLeft + (TableWidth - Len("第" + Str$(PageNum) + "页") * FontSize * 20) / 2, TableTop + TableHeightTemp + 80)
PageNum = PageNum + 1
Printer.FontSize = 12
Printer.Print "第"; PageNum; "页"
Printer.EndDoc
Beep
MsgBox "请换页", vbInformation, "打印信息"
TableLeft = 1000
TableTop = 1000
TableWidthTemp = 0
Printer.PSet (TableLeft + (TableWidth - TitleLen) / 2, TableTop)
Printer.Print TableName
TableTop = TableTop + FontSize * 20 + 100
Printer.Line (TableLeft, TableTop)-(TableLeft + TableWidth, TableTop)
For Y = 0 To MSFlexGrid1.Cols - 1
TableWidthTemp = TableWidthTemp + MSFlexGrid1.ColWidth(Y)
MSFlexGrid1.Row = 0
MSFlexGrid1.Col = Y
Printer.PSet (TableLeft + (TableWidthTemp - MSFlexGrid1.ColWidth(Y)), TableTop)
Printer.FontSize = 9
Printer.Print MSFlexGrid1.Text
Next Y
TableTop = TableTop + MSFlexGrid1.RowHeight(0)
TableHeightTemp = 0
End If
Next PageTemp

TableWidthTemp = 0
Printer.Line (TableLeft, TableTop + TableHeightTemp)-(TableLeft + TableWidth, TableTop + TableHeightTemp)
Do While TableHeightTemp < PageSize - MSFlexGrid1.RowHeight(MSFlexGrid1.Row - 1)
TableHeightTemp = TableHeightTemp + MSFlexGrid1.RowHeight(MSFlexGrid1.Row - 1)
Printer.Line (TableLeft, TableTop + TableHeightTemp)-(TableLeft + TableWidth, TableTop + TableHeightTemp)
Loop
For Y = 0 To MSFlexGrid1.Cols - 1
TableWidthTemp = TableWidthTemp + MSFlexGrid1.ColWidth(Y)
Printer.Line (TableLeft + TableWidthTemp, TableTop - MSFlexGrid1.RowHeight(0))-(TableLeft + TableWidthTemp, TableTop + TableHeightTemp)
Next Y
Printer.Line (TableLeft, TableTop - MSFlexGrid1.RowHeight(0))-(TableLeft, TableTop + TableHeightTemp)
Printer.PSet (TableLeft + (TableWidth - Len("第" + Str$(PageNum) + "页") * FontSize * 20) / 2, TableTop + TableHeightTemp + 80)
PageNum = PageNum + 1
Printer.FontSize = 12
Printer.Print "第"; PageNum; "页"
Printer.EndDoc
End Sub

Private Sub Form_Load()
Dim Row As Integer
Dim Col As Integer

MSFlexGrid1.Rows = 12
MSFlexGrid1.Cols = 6
Call TblHeader
For Row = 1 To 11
For Col = 0 To 5
MSFlexGrid1.TextMatrix(Row, Col) = "第" & Str(Row) & "行 第" & Str(Col) & "列"
Next Col
Next Row
End Sub
回复
发动态
发帖子
VB基础类
创建于2007-09-28

7453

社区成员

VB 基础类
申请成为版主
社区公告
暂无公告