Several functions using the MSFlexGRID control

zhaozj2021-02-08  219

When the VB processing data is displayed, the use of the table is a good method. Although the DataGrid can be bound to the data source, there is always a beautiful infered, so it is not good, so sometimes the application MSFLEXGRID display data is still a better way. The following functions are programs used to control MSFLExGRID

(I have limited ability to express the language, please forgive me)

'MSFlexGrid operation function' merged column Public Function MergeCol (GridObj As Object, ByVal StartCol As Long, ByVal EndCol As Long, ByVal ColValue As String, ByVal CurrentRow As Long) As BooleanIf StartCol> EndCol Or StartCol> GridObj.Cols Or CurrentRow> GridObj .Rows Then MsgBox "Sorry, wrong set up the ranks!", vbOKOnly, App.Title MergeCol = False Exit FunctionEnd IfFor I = startCol To EndColGridObj.MergeCol (I) = TrueGridObj.TextArray (faIndex (GridObj, CurrentRow, I)) = ColValueGridObj .ColAlignment (I) = flexAlignCenterCenterNext IGridObj.MergeRow (CurrentRow) = TrueMergeCol = TrueEnd Function 'combined line Public Function MergeRow (GridObj As Object, ByVal StartRow As Long, ByVal EndRow As Long, ByVal RowValue As String, ByVal CurrentCol As Long) As BooleanIf StartRow> EndRow Or StartRow> GridObj.Rows Or CurrentCol> GridObj.Cols Then MsgBox "Sorry, wrong setting ranks!", vbOKOnly, App.Title MergeRow = False Exit FunctionEnd IfFor I = StartRow To EndRowGridObj.MergeRow (I) = TrueGridObj .TextArray (FainDex (Gridobj, I, Currentcol) = RO wValueGridObj.ColAlignment (CurrentCol) = flexAlignCenterCenterNext IGridObj.MergeCol (CurrentCol) = TrueMergeRow = TrueEnd Function 'Conversion index Public Function faIndex (GridObj As Object, ByVal row As Integer, ByVal col As Integer) As LongIf row> GridObj.Rows Or row < 0 or col> Gridobj.cols or col <0 Then Msgbox "Sorry, Row Settings Errors! ", vbokonly, app.title faIndex = -1 exit functionend iffaIndex = row * gridobj.cols cool portction"

转载请注明原文地址:https://www.9cbs.com/read-2719.html

New Post(0)