鐐瑰嚮MSFlexGrid鏁版嵁鎺т欢鐨勬爣棰樿繘琛屾暟鎹帓搴忥紒
鍙戝竷: 2008-7-15 14:43 | 浣滆: 缃戠粶杞浇 | 鏉ユ簮: 缃戠粶杞浇 | 鏌ョ湅: 74娆
鐐瑰嚮MSFlexGrid鏁版嵁鎺т欢鐨勬爣棰樿繘琛屾暟鎹帓搴忥紒
銆銆鍦ㄨ繘琛屾暟鎹簱缂栫▼鐨勬椂鍊欙紝缁忓父浼氱敤鍒癕SFlexGrid鎺т欢杩涜鏁版嵁鏄剧ず銆傚苟涓斿鏁版嵁杩涜鎺掑簭鏄繀涓嶅彲灏戠殑涓涓幆鑺傘備娇鐢╓INDOWS绯荤粺鐨勭敤鎴凤紝浼氫範鎯簬鐐瑰嚮鏍囬杩涜鏁版嵁鎺掑簭銆傝孧SFlexGrid鎺т欢鏈韩娌℃湁杩欎釜鍔熻兘锛岀瑪鑰呯粡杩囧疄璺碉紝鎬荤粨鍑轰簡鐐瑰嚮MSFlexGrid鏍囬杩涜鎺掑簭鐨勬柟娉曪紝涓庡ぇ瀹朵竴璧峰垎浜
绋嬪簭婧愮爜鍙互鍒版湰浜虹殑缃戠珯涓婁笅杞斤細http://j2soft.008.net/
銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆宕斿崰姘
銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆EMAIL:CUIZM@163.COM
鍏堟坊鍔燤SFlexGrid鎺т欢锛屾柟娉曪細鑿滃崟锛>宸ョ▼锛>閮ㄤ欢锛>Microsoft FlexGrid Control 6.0(鍚庨潰涓虹増鏈彿锛夛紝浠g爜濡備笅锛
Option Explicit
Private Const STR_SORT_ASC = "鈻"
Private Const STR_SORT_DESC = "鈻"
Private Sub Form_Load()
Dim i As Long
'娣诲姞涓浜涜瘯楠屾暟鎹
With MSFlexGrid1
.Rows = 51
.Cols = 5
For i = 0 To 50
.TextMatrix(i, 0) = ("Col" & i)
.TextMatrix(i, 1) = ("Col" & i)
.TextMatrix(i, 2) = ("Col" & i)
.TextMatrix(i, 3) = ("Col" & i)
.TextMatrix(i, 4) = ("Col" & i)
Next
End With
End Sub
'鎺掑簭鍑芥暟
Public Sub Sort(sgrd As MSFlexGrid, y As Single)
With sgrd
If y >= .RowPos(0) And y < .RowPos(1) Then
If .Tag <> "" Then
If .Tag <> .Col Then
.TextMatrix(0, .Tag) = Left(.TextMatrix(0, .Tag), Len(.TextMatrix(0, .Tag)) - 1)
End If
End If
If Right(.TextMatrix(0, .Col), 1) = STR_SORT_ASC Then
.Sort = flexSortGenericAscending
.TextMatrix(0, .Col) = Replace(.TextMatrix(0, .Col), STR_SORT_ASC, STR_SORT_DESC)
ElseIf Right(.TextMatrix(0, .Col), 1) = STR_SORT_DESC Then
.Sort = flexSortGenericDescending
.TextMatrix(0, .Col) = Replace(.TextMatrix(0, .Col), STR_SORT_DESC, STR_SORT_ASC)
Else
.Sort = flexSortGenericDescending
.TextMatrix(0, .Col) = .TextMatrix(0, .Col) & STR_SORT_ASC
End If
.Tag = .Col
End If
End With
End Sub
Private Sub MSFlexGrid1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
Sort MSFlexGrid1, y
End Sub
銆銆浠g爜涓嶅锛屼笉杩囧疄鐜扮殑鍔熻兘杩樻槸寰堟柟渚跨殑锝烇綖锝烇綖锝




发表于 2009-1-5 19:48
| 











