工程中添加部件:DataGrid ……》Microsoft DataGrid control 6.0DBGrid ……》Microsoft Data Bound Grid control 5.0MSHflexGrid ……》Microsoft Hierarchical flexgird control 6.0MSFlexGrid ……》Microsoft flexgird control 6.0
grid是表格的意思datagrid,MsfFlexGrid都慢微软提供的表格控件,用来显示数据的,两者的功有的一样,也有很多不同点。 你可添加部件来使用它们。在工程中添加部件:DataGrid -------Microsoft DataGrid control 6.0MSHflexGrid------ Microsoft Hierarchical flexgird control 6.0MSFlexGrid -----Microsoft flexgird control 6.0
你可以右击左侧的工具条,选Components打开一个对话框到里面找
常见的
DBGrid
MSHflexGrid
MSFlexGrid
MSFlexGrid,DataGrid,DBGrid是VB中预装的表格控件类型。
你可以在工具箱中添加控件,选择你需要的Grid控件即可
msflexgrid,mshflexgrid等控件
因为我经常看到有人引用grid控件,但我不知他引用的是。
Caption = “ 背 景 花 纹 的 实 现”
Borderstyle=3( 无 最 大、 最 小 化 按 钮) 2. 建 网 格 控 件Grid1, 它 的 位 置 和 大 小 将 在 程 序 中 设 置( 与Form1 同 样 大), 属 性 为:
Enabled = False( 焦 点 不 会 落 在 网 格 控 件Grid1 上)
Fillstyle=1( 改 变 所 有 单 元Text 特 性)
Fixedcols=0( 无 固 定 行)
Fixedrows=0( 无 固 定 列)
Gridlines = False( 网 格 行 不 可 见),
Visible = True 3. 建 立 图 象 控 件Picture1, 程 序 运 行 时 将 背 景 花 纹 基 本 图 案 放 入 其 中, 属 性 为
Visible = False( 不 可 见)
Autosize = True( 自 动 调 整 大 小) 4. 控 件 中 加 入Sheridan 3D Controls, 选 取 其 中 的 三 维 命 令 按 钮SSCommand, 建 立 两 个 按 钮
SSCommand1.Caption=“ 退 出”
SSCommand2.Caption=“ 更 换 背 景”( 演 示 不 同 的 背 景 图 案) 它 们 的 属 性Picture 可 调 用 与 背 景 相 同 或 不 同 的 图 案, 如 果 使 用 普 通 的 命 令 按 钮 控 件Command 也 可, 只 是 命 令 按 钮 无 背 景 图 案。 5. 建 立 背 景 图 案 形 成 子 程 序: Dim pictfile As String '位图文件名
Dim FILEPATH As String ' 文件路径
Sub Backpict(pictfile)
picture1.ScaleMode = 3
Form1.ScaleMode = 3
picture1.Picture = LoadPicture(pictfile)
'网格控件覆盖整个窗体背景
grid1.Top = -1
grid1.Left = -1
grid1.Width = Width
grid1.Height = Height
grid1.Cols=Int(Form1.ScaleWidth/picture1.ScaleWidth) + 1
grid1.Rows=Int(Form1.ScaleHeight/picture1.ScaleHeight) + 1
'所有单元大小等于基本图案大小
For I = 0 To grid1.Cols - 1
For j = 0 To grid1.Rows - 1
grid1.ColWidth(I) = picture1.ScaleWidth * 15
grid1.RowHeight(j) = picture1.ScaleHeight * 15
Next j
Next I
'选定所有单元
grid1.SelStartCol = 0
grid1.SelStartRow = 0
grid1.SelEndCol = grid1.Cols - 1
grid1.SelEndRow = grid1.Rows - 1
grid1.Picture = Picture1.Picture
End Sub
6. 窗 体 主 程 序
Private Sub Form_Load()
Private Sub Form_Load()
'得到运行程序路径名,路径名后带反斜杠
If Right(App.Path, 1) <> "\" Then
filePath = App.Path & "\"
Else
filePath = App.Path
End If
'窗体初始显示由Tiles.bmp基本图案组成的背景
pictfile = "c:\windows\Tiles.bmp"
backpict (pictfile)
End Sub
7. 退出程序命令按钮
Private Sub SSCommand1_Click()
End
End Sub
8. 演示不同的底纹图案
Private Sub SSCommand2_Click()
'两种背景图案交替演示
If pictfile = filePath & "Pict1.bmp" Then
pictfile = "c:\windows\Tiles.bmp"
Else
pictfile = filePath & "Pict1.bmp"
End If
Backpict (pictfile)
End Sub 不知上述是datagrid,还是msflexgrid,我两者都试过,都不行,总有属性不匹配
请大家赐教
你可添加部件来使用它们。在工程中添加部件:DataGrid -------Microsoft DataGrid control 6.0MSHflexGrid------ Microsoft Hierarchical flexgird control 6.0MSFlexGrid -----Microsoft flexgird control 6.0