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指定显示在单元或指定范围中的图片CellPictureAlingment指定单元或范围中图片的显示位置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指定显示在最上面的行 VersionFlexArray控件的版本号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 VSFlexGrid1If .Col = .Cols - 1 Then'如果到了最右边的列就跳到下一行第一个可非固定列.Row = Row + 1.Col = .FixedColsElse'向右移动一列.Col = Col + 1End IfEnd WithEnd SubvsflexGrid 如何只能让某些特定列可编辑'修改前看到是否需要修改Private Sub Grid_BeforeEdit(ByVal Row As Long, ByVal Col As Long, Cancel As Boolean)'On Error GoTo errIf UiI10101.valueInt > 2 Then '*************定义允许修改的状态,需修改Cancel = TrueExit SubEnd IfIf Grid.Col = Grid.cols - 8 Or Grid.Col = Grid.cols - 7 Then '*************定义可以修改的列,需修改Cancel = False '使其有效ElseCancel = True '使其无效为真End IfExit SubErr: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 NextIf Not IsNumeric(Grid.EditText) ThenMsgBox "输入不合法,应输入一个数值", vbInformation, "提示"Cancel = TrueExit SubEnd IfEnd 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 SubVSFLEXGRID7 中文输入法自动关闭问题提示同种数据类型的单元格之间变换不要重启输入法.....还有可以看看这代码Private Declare Function GetKeyboardLayoutList Lib "user32" (ByVal nBuff As Long, _lpList As Long) As LongPrivate Declare Function GetKeyboardLayoutName Lib "user32" Alias "GetKeyboardLayoutNameA" _(ByVal pwszKLID As String) As LongPrivate Declare Function GetKeyboardLayout Lib "user32" (ByVal dwLayout As Long) As LongPrivate Declare Function ImmGetDescription Lib "imm32.dll" Alias "ImmGetDescriptionA" (ByVal _hkl As Long, ByVal lpsz As String, ByVal uBufLen As Long) As LongPrivate Declare Function ActivateKeyboardLayout Lib "user32" (ByVal hkl As Long, ByVal _flags As Long) As LongConst IME_CONFIG_GENERAL = 1Const KLF_REORDER = &H8Const KLF_ACTIVATE = &H1Dim la(1 To 16) As Long '输入法列表Dim ActIme As Long '当前输入法Dim X% '当单前输入法数量Private Sub Form_Load()X = GetKeyboardLayoutList(32, la(1))end subPrivate Sub vs1_AfterEdit(ByVal Row As Long, ByVal Col As long) 'vsflexgrid 控件存在输入问题? 以下为避免方法Dim colNumber As LongDim i As LongDim strName$if col=1 then ActivateKeyboardLayout la(1), 1elseActivateKeyboardLayout la(2), 2end ifend 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 Thenmsg = MsgBox("你真的要删除这些记录吗?", vbYesNo + vbQuestion)Select Case msgCase vbYesFor I = VSFlexGrid1.Row To VSFlexGrid1.RowSelStr = Str + VSFlexGrid1.TextMatrix(I, 1) + ","NextStr = Mid(Str, 1, Len(Str) - 1)Cmd_Zl.ActiveConnection = Cnn_ZlCmd_Zl.CommandText = "delete from zlk where 序号 in (" + Str + ")"Cmd_Zl.ExecuteSet Cmd_Zl = NothingCase vbNoCommand6.Enabled = TrueRst_Zl.CloseExit SubEnd SelectElseMsgBox "请选择您要删除的记录!!!", vbExclamationExit SubEnd If这是用vsprinter打印vsflexgrid内容的例子,你可做参考。页面设置的功能我也正在查找,如果找到肯定共享。With VSPrinter1'设置表头,创建打印文档.Header = "|" & strTitle & vbCrLf & "|Page %d " '显示Page n功能.StartDoc.Zoom = 100'显示比例.RenderControl = vsFlexGrid1.Hwnd'把网格内容传递给vsView显示.EndDocEnd 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 settingsDim hl%, tr&, lc&, rd%hl = fg.HighLight: tr = fg.TopRow: lc = fg.LeftCol: rd = fg.Redrawfg.HighLight = 0fg.Redraw = flexRDNone' hide non-selected rows and columnsDim i&For i = fg.FixedRows To fg.Rows - 1If i < Row1 Or i > Row2 Then fg.RowHidden(i) = TrueNextFor i = fg.FixedCols To fg.Cols - 1If i < Col1 Or i > Col2 Then fg.ColHidden(i) = TrueNext' scroll to top left cornerfg.TopRow = fg.FixedRowsfg.LeftCol = fg.FixedCols' print visible areafg.PrintGrid' restore controlfg.RowHidden(-1) = Falsefg.ColHidden(-1) = Falsefg.TopRow = tr: fg.LeftCol = lc: fg.HighLight = hlfg.Redraw = rdEnd Sub960521,提供的“如何设置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"