Private Sub MSHFlexGrid1_Click()
If MSHFlexGrid1.Col = 0 Then MSHFlexGrid1.Text = Chr(124 - Asc(MSHFlexGrid1.Text))
End Sub
Private Sub Form_Load()
Dim i As Long
With MSHFlexGrid1
.FixedCols = 0
.Cols = 4
.TextArray(0) = "Flag"
.TextArray(1) = "i"
.TextArray(2) = "i^2"
.TextArray(3) = "i^3"
For i = 1 To 50
.AddItem vbTab & i & vbTab & i ^ 2 & vbTab & i ^ 3
Next
.RemoveItem 1
For i = 1 To 50
.Row = i
.Col = 0
.CellFontName = "Wingdings 2"
.Text = Chr(IIf(i Mod 2 = 0, 82, 42))
Next
End With
End Sub
Another method:
Option Explicit
Dim strChecked As String
Private Sub Form_Load()
Dim i As Variant, ms_rows As Integer
' Start building the Grid
ms_rows = 20 ' This is the number of rows to print out
With MSFlexGrid1
.Row = 0
.Col = 0
.Rows = ms_rows + 1 'We add 1 to ensure we get all the rows
.Cols = 2
.ColWidth(0) = 250 ' CheckBox column
.ColWidth(1) = 1440 ' Index column
End With
' Now build the Grid
For i = 0 To 20 'm_rows - 1
With MSFlexGrid1
.Row = i: .Col = 0: .CellPictureAlignment = 4 ' Align the checkbox
Set .CellPicture = picUnchecked.Picture ' Set the default checkbox picture to the empty box
.TextMatrix(i, 1) = i
End With
Next
End Sub
Private Sub MSFlexGrid1_Click()
Dim oldx, oldy, cell2text As String, strTextCheck As String
' Check or uncheck the grid checkbox
With MSFlexGrid1
oldx = .Col
oldy = .Row
If MSFlexGrid1.Col = 0 Then
If MSFlexGrid1.CellPicture = picChecked Then
Set MSFlexGrid1.CellPicture = picUnchecked
.Col = .Col + 1 ' I use data that is in column #9, usually an Index or ID #
strTextCheck = .Text
strChecked = Replace(strChecked, strTextCheck & ",", "")
Debug.Print strChecked
Else
Set MSFlexGrid1.CellPicture = picChecked
.Col = .Col + 1
strTextCheck = .Text
strChecked = strChecked & strTextCheck & ","
Debug.Print strChecked
End If
End If
.Col = oldx
.Row = oldy
End With
End Sub
As more easily be coded,mine is the better.
分享到:
相关推荐
A tutorial on adding columns to Explorer’s details view via a column handler shell extension.(13KB)
Adding Classifications to Web Services.
Adding filters to the Open File dialog(24KB)
XKCDIFY! Adding flair to boring Matlab Axes one plot at a time.zip
USB4 1.0 ECN - Adding Condition to Deactivate RS-FEC Encoding.
A class for adding icons to the system tray(120KB)
Taking the pain out of adding a horizontal scrollbar to a listbox.给列表框添加水平滚动条
CircleCheckBox is available in the MavenCentral, so getting it as simple as adding it as a dependencycompile 'com.uniquestudio:checkbox:1.0.10' Usage checkBox = (CircleCheckBox) findViewById(R.id....
Adding Password Management to Your Templates(cloudstack)
Adding a Node to a 10g RAC Cluster 希望对那些ORACLE使用者有点作用
Adding a search facility to your website
In the second half we get several samples working to show you how everything comes together. Vector maps (line maps) Vs satellite or aerial imagery Spatial Databases PostgreSQL OGC services: Web Map ...
Adding white noise to a signal with fixed SNR
综合能源的优化调度问题主要以经济性为主,应用商业求解器进行优化求解。是现在比较热门的研究方向,只是少数据。
NULL 博文链接:https://liu-weiaa.iteye.com/blog/666585
Adding a Build Banner to ASP.NET Pages。
Adding ODBC support to a new application使你的程序添加ODBC支持
DM81xx AM38xx Adding External Decoders to V4L2 Capture Driver
信息安全_数据安全_Adding Social Intelligence to Smart Devices 应急响应 内外威胁 工控安全 web安全 数据脱敏
VTK\Adding_Components_to_VTK_Designer_2