vsgflexgird的全面介绍

FlexString控件属性一览表
Error失败时取得错误信息
MatchCount取得与检索条件相一致的字符串数量
MatchIndex设定与检索条件相一致的字符串的索引
MatchLength取得与检索条件相一致的字符串长度
MatchStart
取得与检索条件相一致的字符串起始位置
MatchString取得与检索条件相一致的字符串
Pattern 设定检索条件
Replace设定置换字符串
SoundexText取得代表当前检索字符的声音代码
TagCount取得与检索条件相一致的标签数量
TagIndex在多个标签情况下,设定/取得与检索条件相一致的标签索引
TagLength取得与检索条件相一致的标签长度
TagStart取得与检索条件相一致的标签起始位置
TagString取得与检索条件相一致的标签的字符串
Text设定成为检索对象
Version取得FlexString的版本号


FlexString控件属性一览表
AllowBigSelection设定行列头的选择
AllowUserResizing设定行列大小的设定
BackColor设定FlexArray所有表格的背景颜色
BackColorBkg设定背景颜色
BackColorFixed设定固定行/列的背景颜色
BackColorSel设定选择单元的背景颜色
CellAlignment设定单元里数据的排列方式
CellBackColor设定单元或指定范围的背景颜色
CellFontBold把单元或指定范围的字体设定为黑体字
CellFontItalic把单元或指定范围的字体设定为斜体字
CellFontName设定单元或指定范围的字体
CellFontSize设定单元或指定范围字体的大小
CellFontWidth设定单元或指定范围字体的宽度
CellForeColor设定单元或指定范围字体的颜色
CellHeight返回当前单元的高度
CellLeft返回当前单元的左端位置
CellTop返回当前单元的顶端位置
CellWidth返回当前单元的宽度
CellPicture指定显示在单元或指定范围中的图片
CellPicture
Alingment指定单元或范围中图片的显示位置
CellTextStyle设定单元文本的显示形式
Clip<设定/返回选择范围的内容
Col设定/返回激活单元的列号
ColAlingment( )设定/返回列的排列方式
ColData( )设定/返回一个用户定义信息的长整形数据
ColPosition( )移动列的位置
Cols指定返回列的总数
ColSel指定选择范
ColWidth( )设定所指定列的宽度
FillStyle指定是否改变当前单元或选择范围的内容或单元格式
FixedCols设定固定列的总数
FixedRows设定固定行的总数
FocusRect设定选中单元周围的Focus Rectangle类型
FontWidth设定字体的宽度
ForeColorFixed设定固定单元的文本颜色
ForeColorSel设定选择单元的文本颜色
FormatString在设计过程中设定列宽、排列方式及固定的行/列
GridColor指定网格线的颜色
GridColorFixed设定固定网格线的颜色
GridLines指定网格线的类型
GridLinesFixed指定固定单元的网格线形式
HighLight设定是否突出显示选中单元
LeftCol指定显示在最左边的列
MergeCells设定是否合并内容相同的单元格
MergeCol( )设定指定列的单元合并
MergeRow( )设定指定行的单元合并
MouseCol设定鼠标指向的列号
MouseRow设定鼠标指向的行号
ReDraw设定是否刷新FlexArray控件
Picture返回FlexArray控件的图片
PictureType指定用Picture属性生成的图片类型
Row设定/返回激活单元的行号
RowData( )设定/返回一个用户定义信息的长整形数据
RowHeight( )设定指定行的高度
RowHeightMin设定行高的最小值
RowPosition( )移动行的位置
Rows指定行的总数
RowSel指定行的选择范围
SelectionMode设定行、列或单元的选择方式
ScrollBars设定卷动轴的类型
ScrollTrack设定卷动方式
Sort按照选择的基准重新排列行的顺序
Text设定/取得单元的文本
TextArray( )设定/取得任意单元的文本
TextMatrix( )设定/取得任意单元的文本
TextStyle显示单元中文本的3D效果
TextStyleFixed显示固定行/列中文本的3D效果
TopRow指定显示在最上面的行
Version
FlexArray控件的版本号
WordWrap设定单元中的文本是否换行


VSflexgrid的破解方法
注册方法:编辑注册表
HKEY_CLASSES_ROOT/Licenses/403E0785-49A9-11d3-9BD5-D2DC2DD96072


听过vsview7.0没有?这是破解方法,只需要在注册表里建立三个键就可以.如下:
REGEDIT4
VSVIEW 7
[HKEY_CLASSES_ROOT/Licenses/04589820-F8F4-11d3-9A1F-AE842F4A083B]
@=""
[HKEY_CLASSES_ROOT/Licenses/F403E0785-49A9-11d3-9BD5-D2DC2DD96072]
@=""
[HKEY_CLASSES_ROOT/Licenses/403E0785-49A9-11d3-9BD5-D2DC2DD96072]
@=""

在vsflexgrid中单元格输入完毕后,设置按回车键跳到同一行的下一个单元

Private Sub VSFlexGrid1_AfterEdit(ByVal Row As Long, ByVal Col As Long)
With VSFlexGrid1
If .Col = .Cols - 1 Then
'如果到了最右边的列就跳到下一行第一个可非固定列
.Row = Row + 1
.Col = .FixedCols
Else
'向右移动一列
.Col = Col + 1
End If
End With
End Sub

vsflexGrid 如何只能让某些特定列可编辑

'修改前看到是否需要修改
Private Sub Grid_BeforeEdit(ByVal Row As Long, ByVal Col As Long, Cancel As Boolean)
'On Error GoTo err

If UiI10101.valueInt > 2 Then '*************定义允许修改的状态,需修改
Cancel = True
Exit Sub
End If
If Grid.Col = Grid.cols - 8 Or Grid.Col = Grid.cols - 7 Then '*************定义可以修改的列,需修改
Cancel = False '使其有效
Else
Cancel = True '使其无效为真
End If
Exit Sub
Err:
RaiseErr "frmY005-Grid_MouseDown()"
End Sub


'修改后判断是否合法
'cancel=true 取消修改的
Private Sub Grid_ValidateEdit(ByVal Row As Long, ByVal Col As Long, Cancel As Boolean)
On Error Resume Next
If Not IsNumeric(Grid.EditText) Then
MsgBox "输入不合法,应输入一个数值", vbInformation, "提示"
Cancel = True
Exit Sub
End If

End Sub

'修改后来更改别的一些数据
Private Sub Grid_AfterEdit(ByVal Row As Long, ByVal Col As Long)
On Error Resume Next
'进货数量=包装数量 * 整装数量 + 零装数量
Grid.TextMatrix(Row, Grid.cols - 6) = Grid.TextMatrix(Row, Grid.cols - 9) * Grid.TextMatrix(Row, Grid.cols - 8) + Grid.TextMatrix(Row, Grid.cols - 7)

End Sub


VSFLEXGRID7 中文输入法自动关闭问题提示

同种数据类型的单元格之间变换不要重启输入法.....
还有可以看看这代码
Private Declare Function GetKeyboardLayoutList Lib "user32" (ByVal nBuff As Long, _
lpList As Long) As Long
Private Declare Function GetKeyboardLayoutName Lib "user32" Alias "GetKeyboardLayoutNameA" _
(ByVal pwszKLID As String) As Long
Private Declare Function GetKeyboardLayout Lib "user32" (ByVal dwLayout As Long) As Long
Private Declare Function ImmGetDescription Lib "imm32.dll" Alias "ImmGetDescriptionA" (ByVal _
hkl As Long, ByVal lpsz As String, ByVal uBufLen As Long) As Long
Private Declare Function ActivateKeyboardLayout Lib "user32" (ByVal hkl As Long, ByVal _
flags As Long) As Long

Const IME_CONFIG_GENERAL = 1
Const KLF_REORDER = &H8
Const KLF_ACTIVATE = &H1

Dim la(1 To 16) As Long '输入法列表
Dim ActIme As Long '当前输入法
Dim X% '当单前输入法数量

Private Sub Form_Load()
X = GetKeyboardLayoutList(32, la(1))
end sub

Private Sub vs1_AfterEdit(ByVal Row As Long, ByVal Col As long) 'vsflexgrid 控件存在输入问题? 以下为避免方法
Dim colNumber As Long
Dim i As Long
Dim strName$
if col=1 then
ActivateKeyboardLayout la(1), 1
else
ActivateKeyboardLayout la(2), 2
end if
end Sub

用.AddItem在最后一行显示数据
Rst_Hj.Open HjSQL, Cnn_Zl, adOpenDynamic, adLockOptimistic 'RST_hj是合计的记录集
Main_YX.VSFlexGrid1.AddItem vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & "合计" & vbTab & Rst_Hj.Fields(0) & vbTab & Rst_Hj.Fields(1) & vbTab & Rst_Hj.Fields(2) & vbTab & Rst_Hj.Fields(3) 'VBTAB是跳过一格填写
Rst_Hj.Close

删除连续选择的记录
If VSFlexGrid1.Row <> -1 And VSFlexGrid1.RowSel <> -1 Then
msg = MsgBox("你真的要删除这些记录吗?", vbYesNo + vbQuestion)
Select Case msg
Case vbYes
For I = VSFlexGrid1.Row To VSFlexGrid1.RowSel
Str = Str + VSFlexGrid1.TextMatrix(I, 1) + ","
Next
Str = Mid(Str, 1, Len(Str) - 1)
Cmd_Zl.ActiveConnection = Cnn_Zl
Cmd_Zl.CommandText = "delete from zlk where 序号 in (" + Str + ")"
Cmd_Zl.Execute
Set Cmd_Zl = Nothing
Case vbNo
Command6.Enabled = True
Rst_Zl.Close
Exit Sub
End Select
Else
MsgBox "请选择您要删除的记录!!!", vbExclamation
Exit Sub
End If
这是用vsprinter打印vsflexgrid内容的例子,你可做参考。页面设置的功能我也正在查找,如果找到肯定共享。
With VSPrinter1
'设置表头,创建打印文档
.Header = "|" & strTitle & vbCrLf & "|Page %d " '显示Page n功能

.StartDoc
.Zoom = 100'显示比例
.RenderControl = vsFlexGrid1.Hwnd'把网格内容传递给vsView显示
.EndDoc
End With

有谁知道vsflexgrid1.PrintGrid命令参数怎么用?附上原英文帮助,有谁看懂了请解释一下好吗!
Prints the grid on the printer.
Syntax
[form!]VSFlexGrid.PrintGrid [ DocName As String ], [ ShowDialog As Boolean ], [ Orientation As Integer ], [ MarginLR As Long ], [ MarginTB As Long ]
Remarks
The parameters for the PrintGrid method are described below:


DocName As String (optional)
Contains the name of the document being printed. This string appears in the printer window's job list and is also used as a footer.

ShowDialog As Variant (optional, default value = False)
If set to True, a printer selection/setup dialog is displayed before the document start printing. The user can then select which printer to use, page orientation etc.

Orientation As Variant (optional, default value = printer default)
Set this parameter to 1 to print the grid in Portrait mode, or set it to 2 to print the grid in Landscape mode. The default setting, zero, uses the default printer orientation.

MarginLR As Variant (optional, default value = 1440)
Left and right margins, in twips. The margins must be equal. The default value, 1440, corresponds to a one-inch margin.

MarginTB As Variant (optional)
Top and bottom margins, in twips. The margins must be equal. The default value, 1440, corresponds to a one-inch margin.


The grid is printed using the same fonts used to display it on the screen, so to achieve best results, make sure the grid's Font property is set to a TrueType font (such as Arial, Times New Roman, Tahoma, or Verdana).

While printing the grid, the control fires the BeforePageBreak and GetHeaderRow events. These events allow you to control page breaks and setup repeating headers.

The PrintGrid method prints the entire grid, possibly spilling across and down to new pages. To print only a part of the grid, hide to rows and columns you don't want to print, call the PrintGrid method, and restore the hidden rows and columns when you are done.

The code below shows how you can do this:

Private Sub PrintSelection(fg As VSFlexGrid, Row1&, Col1&, Row2&, Col2&)

' save current settings
Dim hl%, tr&, lc&, rd%
hl = fg.HighLight: tr = fg.TopRow: lc = fg.LeftCol: rd = fg.Redraw
fg.HighLight = 0
fg.Redraw = flexRDNone

' hide non-selected rows and columns
Dim i&
For i = fg.FixedRows To fg.Rows - 1
If i < Row1 Or i > Row2 Then fg.RowHidden(i) = True
Next
For i = fg.FixedCols To fg.Cols - 1
If i < Col1 Or i > Col2 Then fg.ColHidden(i) = True
Next

' scroll to top left corner
fg.TopRow = fg.FixedRows
fg.LeftCol = fg.FixedCols

' print visible area
fg.PrintGrid

' restore control
fg.RowHidden(-1) = False
fg.ColHidden(-1) = False
fg.TopRow = tr: fg.LeftCol = lc: fg.HighLight = hl
fg.Redraw = rd
End Sub

960521,提供的“如何设置vsflexgrid某行背景色”:

VSFlexGrid1.Cell(flexcpBackColor, row1, col1,row2, col2) = vbRed

例:设置第三行北景色为红
VSFlexGrid1.Cell(flexcpBackColor, 3, 1, 3, VSFlexGrid1.Cols - 1) = vbRed

 

VSFlexGrid 控件属性方法一览表(带()为方法)
属性/方法名称 功能 示例语法
AddItem() 增加一行 O.A String[, RowIndex]
Aggregate 返回集合合计(总数,平均,等等) O.A = (A,Row1,Col1,Row2,Col2)
Align 对象在窗体上的显示位置 O.A = 0 ¦1 ¦2 ¦3 ¦4
AllowBigSelection 设定列头是否整行或整列选择 O.A = True ¦False
AllowSelection 是否可多单元选择 O.A = True ¦False
AllowUserFreezing 运行时用鼠标冻结行或列 O.A = 0 ¦1 ¦2 ¦3
AllowUserResizing 调整(行/列)大小方式 O.A = 0 ¦1 ¦2 ¦3 ¦4
Appearance 边框平面/凹陷/凸起 O.A = 0 ¦1 ¦2
Archive() 存储或清除一个二进制文件内容 O.A ArcFileName,FileName,0 ¦1 ¦2 ¦3
ArchiveInfo 返回一个二进制文件信息 O.A ArcFileName,0 ¦1 ¦2 ¦3 ¦4,LineIndex
AutoReSize 是否自动调整大小 O.A = True ¦False
AutoSearch 设置自动搜索 O.A = 0 ¦1 ¦2
AutoSearchDelay 设置AutoSearch多少秒刷新 O.A = 2
AutoSize() 自动调整列到指定宽度 O.A Col1,Col2,True ¦False,1000
AutoSizeMode 自动调整适合行列内容 O.A = 0 ¦1
AutoSizeMouse 是否双击列首自动调整适合行列 O.A = True ¦False
BackColor 所有非固定行列的背景色 O.A = Color
BackColorAlternate 所有非固定行列的交替行颜色 O.A = Color
BackColorBkg 表格背景坐底色 O.A = Color
BackColorFixed 固定的行/列背景色 O.A = Color
BackColorFrozen 冻结部分的行列背景色 O.A = Color
BackColorSel 单元被选中的背景色 O.A = Color
BindToArray() 绑定数组 O.A ArrayStr,RowDim,ColDim,PageDim,CurrentPage
Bookmark 返回ADO Recordset行书签(只读) O.A(Row)
BorderStyle 边框粗细样式 O.A = 0 ¦1
BottomRow 返回可见范围的最大行号(只读) O.A
BuildComboList() 将数据库中的内容写入下拉框 O.A(rs, FieldList, KeyField, BackColor)
CausesValidation ???目标事件确认 O.A = False ¦True
Cell 选择部分的相应准则值 O.A(准则, Row1, Col1, Row2, Col2) = 准则值
CellAlignment 设定单元里数据的排列方式 O.A = 0 至 9
CellBackColor 指定单元范围的背景颜色 O.A = Color
CellBorder() 选择单元范围的边界颜色 O.A Color,左,上,右,下,垂直,水平
CellButtonPicture 选择单元范围的按钮图片 O.A = LoadPicture("D:/Icon.ico")
CellChecked 选择单元范围的复选框 O.A = 0 ¦1 ¦2
CellFloodColor 选择单元范围的流程颜色 O.A = Color
CellFloodPercent 选择单元范围的流程百分比 O.A = 1 至 100
CellFontBold 指定单元范围设为黑体字 O.A = False ¦True
CellFontItalic 指定单元范围设为斜体字 O.A = False ¦True
CellFontName 对象所使用的字体名称 O.A = FontName
CellFontSize 对象文字像数大小(默认9pt) O.A = 9
CellFontStrikethru 选择范围是否有删除线 O.A = False ¦True
CellFontUnderline 选择范围是否有下画线 O.A = False ¦True
CellFontWidth 设定单元或指定范围字体的宽度 O.A = 2
CellForeColor 设定单元或指定范围字体的颜色 O.A = Color
CellHeight 返回/显示到当前单元高度(只读) O.A
CellLeft 返回当前单元的左端位置(只读) O.A
CellPicture 显示在单元或指定范围中的图片 O.A = LoadPicture("D:/Icon.ico")
CellPictureAlingment 单元或指定范围图片的显示位置 O.A = 0 至 10
CellTextStyle 设定单元文本的显示形式 O.A = 0 ¦1 ¦2 ¦3 ¦4
CellTop 返回当前单元的顶端位置(只读) O.A
CellWidth 返回当前单元的宽度(只读) O.A
Clear() 清除表格内容 O.A([0 ¦1 ¦2],[0 ¦1 ¦2 ¦3])
ClientHeight 返回客户可见范围高度 O.A
ClientWidth 返回客户可见范围宽度 O.A
Clip 设置选择范围的内容 O.A = Text
ClipSeparators ???
Col 设置激活单元的列号 O.A = 2
ColAlignment 列对齐排列方式 O.A(Col) = 0 至 9
ColComboList 向下拉框写入管道字符 O.A(Col) = " ¦ListStr1 ¦ListStr2 ¦..."
ColData 设置用户定义的长整形数据 O.A(Col) = UserLong
ColDataType 列数据类型 O.A(Col)=0至14到20(&H14),30(&H1E),31(&H1F)
ColEditMask 列编辑套用格式字符串 O.A(Col) = 指定的格式如:######
ColFormat 格式化显示列 O.A(Col) = "Currency" ¦"#.###%"...
ColHidden 是否隐藏指定列 O.A(Col) = True ¦False
ColImageList 设置图像列表句柄到列
ColIndent 缩进指定列 O.A Col= 100
ColIndex 返回列索引(只读) O.A Col
ColIsVisible 返回列是否可见(只读) O.A Col
ColKey 设置列钥匙 O.A(Col) = KeyStr
ColPos 返回列距左边宽度(只读) O.A Col
ColPosition 移动列的位置 O.A(Col) = ReCol
Cols 返回/设置总列数 O.A = 2
ColSel 返回/设置最后选择的列 O.A = 3
ColSort 设置列种类 O.A(Col) = 0 至 10
ColWidth 返回/设置指定列宽 O.A(Col) = 100
ColWidthMax 最大列宽 O.A(Col) = 5000
ColWidthMin 最小列宽 O.A(Col) = 100
ComboCount 取得Combo下拉按钮总数(只读) O.A
ComboDataCombo 下拉按钮数据(只读) O.A
ComboIndex Combo下拉按钮索引 O.A = 1
ComboItemCombo 下拉按钮项目(只读) O.A
ComboList 向下拉框写入管道字符内容 O.A = "a ¦b ¦c"

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值