1) Important properties of MSHFLEXGRID.
MshflexGrid's properties are very much, and most of the properties of the properties are related to the appearance of the display of the grid. In the MSDN, these properties are full of dazzling (I believe you have no tolerance).
The commonly used properties, method events, and their brief description are listed below.
Property Type Description
ALLOWBIGSELECTORBOOLAN Returns / sets a value, defined whether the row or column will be selected when you click on the head or column header.
ALLOWUSESIZINGENUM setting / return a value, define if the user can adjust the grid, the size of the column
BackColorole_color Settings / Return to a background color of the non-fixed unit in a grid
BackcolorbandArray / OLE_COLOR Settings / Return to the background color of each independent BAND in the grid
BachColorBkgole_color setting / return to the background color of the grid (except the unit head)
Backcolorfixedole_color Settings / Return the background color of the fixed unit in the grid
BackcolorHeaderarray / OLE_COLOR Settings / Return to the background color of the grid head unit
BackcolorindenTARRAY / OLE_COLOR Settings / Return Background Color in the Grid
BackcolorSelole_color Settings / Return Grid Select Unit Background Color
BackcolorunPopulateDole_color Settings / Return the background color of the mesh non-user operating area
BandDataArray / long is an unique value to return any value, and determine Band through these values in the code.
BANDDISPLAYENUM Defines the band in the grid or vertical display
BandExpandableArray / Boolen Setup / Return Value specifies that the independent BAND can be folded or expanded
BandindentArray / long define the number of fields that divide the band
BandleVellong returns the total number of BANDs included in the current unit
Bandslong Returns the total number of BANs in the grid
CELLALIGNMENTEGER Settings / Returns a value to define the horizontal and vertical alignment of the current unit
CellbackColorole_color Defines whether the font of the current unit is bold
CellFontBoldBoolean defines whether the font of the current unit is bold
CellFontitalCococoolean Defines whether the font of the current unit is italic.
CellFontNameString defines the font name of the current unit
Cellfontsizestring defines the font size of the current unit
CellFontStrikeTHOUGHBOOLEAN Defines whether the font of the current unit is a sudden display.
CellFontunderLineBoolean defines the font of the current unit is underscore
CellFontWidthsingle defines the font wide in the current unit (indicated by point)
CellFontColorole_color Settings / Return the foreground color of the current cell
CellHeightlong Settings / Returns the height of the current cell
CellLeftlong returns the left side of the current cell
CELLPICTURESTDPICTURE Settings / Returns Picture of Current Cell
CellPictureAlignmentinteger Settings / Returns the image alignment of the current cell or a range of cells
CELLTEXTSTYLEEENUM Settings / Return the 3D style of the current unit or selected range unit text
CellToplong Returns the vertical position of the current cell
CellTyPeenum Settings / Returns the type of current cell (standard. Fixed)
CellWidthlong returns / sets the width of the current unit
Clipstring Settings / Return Content of Grid Selected Range Unit
Colarray / Integer Settings / Returns the horizontal coordinates of the current unit
COLALIGNMENTARRAY / INTEGER Settings / Return to the current alignment
COLALIGNMENTBANDARRAY / INTEGER Settings / Return to BAND Data Columns Alignment
COLALIGNMENTFIXED ARRAY / INTEGER Settings / Return to fixed unit data alignment
COLALIGNMENTHEADERARRAY / INTEGER Settings / Return to fixed head unit data alignment
COLDATAYYAY / Long is a standalone column setting / return any value, in line with these values to determine whether column colheadrarray / enum defines if each BAND header is displayed
ColheadercaptionArray / Single Defines the text displayed by the column header of each BAND
ColisVisibleArray / Boolen returns / sets if a column is visible
ColposArray / long returns a distance from the upper left corner of a given column and the distance from the upper left corner of the grid.
ColpositionArray / long settings of the grid column
Colslong returns / sets the number of columns
ColselaRray / long setting / return to a range unit
COLWIDTHARRAY / Long Settings / Return to a width of a column
COLWORDWRAPOPTION ARRAY / INTEGER Settings / Return Non-fixed units to allow WRAP
COLWORDWRAPOTIONBANDARRAY / INTEGER Defines whether the grid is allowed to allow WRAP
COLWORDWRAPOTIONFIXEDARRAY / INTEGER Definition Column The fixed unit allows WRAP
COLWORDWRAPOPTIONHEADERRAY / INTEGER Defines whether the heads are allowed to allow WRAP
DatafieldArray / Single A separate column bound database field
FillStyleNum defines that other properties of the text or unit are affecting all selected units or only affects the activity unit.
FIXEDCOLSLONG Settings / Return the number of columns
FixedrowSlong Settings / Return the number of rows of fixed lines
FocusRectenum defines the focus of the current unit
FontstDFont Returns / Set the fonts used by default fonts or units
FontBandArray / StdFont Settings / Return each band using the font
FontFixedsingle Settings / Returns Fonts Used by Fixed Units
FontHeader Array / StdFont Settings / Return the fonts used in each head
FontWidthSingle Settings / Return Default Font Width
FontWidthbandArray / Single Settings / Return the Width Used by Band
FontwidthfixedsingSingle Settings / Return Fixed Width
FontWidthHeaderarray / Single Settings / Return the Width Used in Each Head
ForecolRole_color Settings / Return the foreground color used by the grid non-fixed unit
ForecolorbandArray / OLE_COLOR Settings / Return to the foreground color of each BAND
Forecolorfixedole_color Settings / Returns the foreground color of the grid fixing unit.
ForecolorHeaderarray / OLE_COLOR Settings / Return to the foreground color of the grid head unit
ForecolorSelole_color Settings / Return the foreground color of the setting unit
FormatStringstring defines a format string to set the width, alignment, and fixed line text fixed column text.
GridColorole_color Settings / Return to the color of the grid unit
GridColorbandArray / OLE_COLOR Settings / Return to the color of the grid BAND
GridColorfixedole_color Settings Color of the line between the grid fixing unit
GridColorHeaderarray / OLE_COLOR Settings / Return to the color between the grid head
GridColorindentole_color Settings / Return Colors of the Line of the Grid Indent Unit
GridColorunPopulate_color Settings / Return to the color between the grid unpopulated area
GriglineEnum defines the type of line between the grid unit
GriglinesBandArray / Enum Defines the type of lines between each BAND in the grid
Griglinesfixedenum Defines the type of the line of the grid fixing unit
GriglineSheaderarray / enum defines the type of line between the grid's heads
GriglinesindENTARRAY / ENUM Defines the type of line between grid indent units
GriglinesunpopulateDenum Defines the type of line between the grid unpopulated area
GriglinesWidthinteger Settings / Return the width of the line between the grid unit GriglinesWidthbandArray / Integer Settings / Return the width of the line between each BAND
Griglineswidthfixedinteger Settings / Return the width of the line between the grid fixation unit
GriglineswidthHeaderarray / Integer Settings / Return the width of the line between the grid
GriglinesWidthindenTArray / Integer Settings / Return the width of the line between the grid indent unit
GriglineswidthunpopulateDinteger Settings / Return the width between the grid unpopulate
Hieghtenum definition how and when high brightness display grid selection unit
LEFTCOLLONG mesh is most visible
MergecellSenum Settings / Return A Value indicates how and when you will have a record of the same content
MergeColarray / Boolen Settings / Return a value indicates which columns can be merged
MergeroWArray / Boolen setting / return a value indicates which rows can be merged
Mousecollong Returns the column coordinate position of the mouse cursor
Mouselowlong Returns the row coordinate position of the mouse cursor
PicturestDPicture Returns the control snapshot of MSHFLExGrid
PictureTyPEENUM Settings / Return to Picture Type
RedrawBoolean setting / return a value, indicating whether the MSHFLEXGRIDR control is returned after each change
Rowlong Settings / Return the vertical coordinates of the current unit
RowDataArRay / long is set / returned to any value in each row, and it is determined by these values in the code.
ROWEXPANDABLEBOOLAN Defines if the current line can be expanded
RowPandedBoolean Returns a value indicates whether the current line is expanded.
RowheighTarray / long setting / return to the height of each line
RowHeightminLong Settings / Return to the minimum height of the line in the grid
RowisvisibleArray / Boolen Set / Return a value indicates whether a particular column is visible
RowPosArray / long returns the distance from the upper left corner of the row and the upper left corner of the MSHFLEXGRID control
RowPositionArray / long set a location of a grid
Rowslong returns the total number of rows of the grid or the total number of BANDs
RowSellong setting / return a range of starting lines
RowsizingModeenum Settings / Return A Value Indicates that the settings of the line are all rows that affect the grid or only affect the adjusted line.
ScrollBarsenum Settings / Return a value indicates the scroll bar type of the MSHFLExGrid control
ScrollTrackBoolean setting / return a value indicates that the grid content changes when the user moves the scroll bar changes after the scrolling ends.
SelectionModeNum Settings / Return a value indicates that the MFHFLEXGRID control allows the selected type.
Sortenum preparations for sorting values in some villages
TextString Settings / Returns a unit or a range of text content
TextArrayArray / String does not change the text content of Row, COL attribute, setting / return any unit
TextMatrixArray / String Settings / Returns the text content of a unit selected
TextStyleEnum Settings / Returns 3D text style of the mesh usual unit
TEXTSTYLEBANDARRAY / ENUM Settings / Return to Grid Band 3D Text Style
TextStylefixedenum Settings / Return the 3D text style of each fixed line of each grid
TextStyleHeaderarray / Enum Settings / Return 3D text style of each head of the grid
TOPROWLONG Settings / Return the top of the grid
VersionInteger returns the version that is using the MSHFLEXGRID control
WordWrapBoolean defines whether the content of the unit of the grid is Wrap when the boundary of the unit is reached.
2) Important method for MSHFLEXGRID control
Method description
AddItem joins a new line to the grid
Clear clears the content in the grid
ClearStructure Clears the structure of the grid (mapping information)
COLLAPSEALL folding grid A specific all lines of Expandall expands a specific row of the grid
REMOVEITEM Clears a line from the grid
Methods AddItem and RemoveItem can be used to join or delete rows to grid. If folded or expands all rows for a BAND, you can use collapseall and expaandall methods.
Method clear can clear the content in the grid, but does not affect the grid's row, the number of columns, if you want to clear the structure of the grid, including the name of the order and the grid, should use the ClearStructure method.
3) Main events of MSHFELXGRID control
Collapse users folded a line of grid
Compare When the Sort property is set to Customersort, allow the user to define the ordering process
Entercell When a new unit becomes a current activity unit (obtained)
Expand users expanded a line of grid
Leavecell When a new unit becomes the current activity unit (leaving)
RowColchange When a new unit is a current activity unit
Scroll users use keyboards, scroll bars, scrolling grids, scrolling, scrolling
SELCHANGEVENT a new range of units selected
Entercell, Leavecell, RowColchange events are interrelated because they are excited when a new unit is a current activity unit, in fact, the order of these events is: Leavecell, Entercell then is RowColchange.
COLLAPSE and Expand events are excited when the user is folded or expanded. The property Row and Col can be used to determine the user folded or expanded units.
When the sort property is set to 9, a Compare event is once in each two lines of the grid. The user sorting method allows you to select in the afternot or unit pending. Note that the speed of using this sorting will be slower than build -In sort.
Regardless of the way, as long as the grid is scrolling, the scroll event will be excited. When the ScrollTrack property is set to TRUE, the event is also excited if the user is dragging or scrolling, if the scrolltrack property is set. When False, the Scroll event is only excited after the drag is over.
When the cell changes, the SELCHANGEVENT event is excited, and the change in the range of unit ranges can be achieved by user operation or program code.
Write the following code into the common module
'Support Roller Mouse API ---------------------------------
Public const gwl_Wndproc = (-4)
Public const wm_command = & h111
Public const wm_mbuttondown = & h207
Public const wm_mbuttonup = & H208
Public const wm_mousewheel = & h20a
Public OldwinProc As Long
Public Declare Function SetWindowlong Lib "User32" Alias "Setwindowlonga" (Byval Hwnd As Long, _
BYVAL NINDEX As Long, Byval Dwnewlong As Long AS Long
Public Declare Function CallWindowProc Lib "User32" Alias "CallWindowProca" (BYVAL LPPREVWNDFUNC AS Long, _
BYVAL HWND As Long, Byval WParam As Long, Byval LParam As Long AS Long
Public Declare Function GetWindowlong Lib "User32" Alias "getwindowlonga" (Byval HWNDEX AS Long) AS Long
Public Function FlexScroll (Byval Hwnd As Long, Byval WParam As Long, BYVAL LPARAM AS Long)
'Support Rolling Rolling Yu 2004-5-10 15:33
SELECT CASE WMSG
Case WM_MOUSEWHEEL
Select Case WPARAM
Case -7864320 'roll down
SendKeys "{pgdn}"
Case 7864320 'roll up
SendKeys "{PGUP}"
End SELECT
End SELECT
FlexScroll = CallWindowProc (OldwinProc, HWND, WMSG, WPARAM, LPARAM)
END FUNCTION
'Support Roller Mouse API ---------------------------------
'Write the following code to the gotfocus event of the table control
Private sub control name_gotfocus ()
OldwinProc = getWindowlong (me.hwnd, gwl_wndproc)
SetWindowlong Me.hWnd, GWL_WndProc, Addressof flexscroll
End Sub
'Write the following code to the LostFocus event of the table control
Private Sub Control Name_Lostfocus ()
Setwindowlong Me.hwnd, GWL_WndProc, OldwinProc
End Sub