This project is intended to replace the MSFlexGrid control for VB6.
The "MSFLXGRD.OCX" can be replaced completly.
Even though some enhancements of the MS
HFlexGrid control are included, it can't replace it completly (yet).
But there are also new features included that are not available on both MSFlexGrid and MSHFlexGrid.
The VBFlexGrid supports
Unicode and is
DPI-Aware.
At design time (IDE) there is only one dependency. (OLEGuids.tlb)
This is a modified version of the original .tlb from the vbaccelerator website.
But for the compiled .exe there are
no dependencies, because the .tlb gets then compiled into the executable.
In order to use the DataSource/DataMember property a reference to msdatsrc.tlb (pre-installed since Win2k) is required.
Everything should be self explained, because all functions and properties have a description.
The source code of the project can also be viewed on
GitHub.
ActiveX Control version, together with a Registration-Free (Side-by-side) solution:
Version 1.2
Notes:
- When using the SetParent or MoveWindow API, pass .hWndUserControl and
not .hWnd.
- When changing the "Project Name", have all forms open, else all properties are lost. Because the library to which the controls are referring to is the "Project Name" itself. Having all forms open will ensure that the .frx files will be updated with the new "Project Name".
- In order to trap error raises via "On Error Goto ..." or "On Error Resume Next" it is necessary to have "Break on Unhandled Errors" selected instead of "Break in Class Module" on Tools -> Options... -> General -> Error Trapping.
List of revisions:
Code:
20-May-2019
- Removed ComboEditable/ColComboEditable as it got replaced by ComboMode/ColComboMode and ComboItems/ColComboItems.
- New ComboMode/ColComboMode property with FlexComboModeConstants
- FlexComboModeNone -> No combo button, normal editing.
- FlexComboModeDropDown -> Allows to modify by drop-down list only.
- FlexComboModeEditable -> Allows to modify by edit and drop-down list.
- New ComboItems/ColComboItems property that defines the list items to be used when ComboMode is DropDown or Editable.
19-May-2019
- Bugfix in the Picture property. (related to 08-May-2019 update)
- Combo button window now drawm themed, if applicable.
18-May-2019
- Bugfix concerning RightToLeftLayout for in-cell editing combo button and combo list window.
- Combo button window is now being hot-tracked.
16-May-2019
- Renaming of properties related to 15-May-2019 update:
- ComboList -> ComboEditable
- ColComboList -> ColComboEditable
- ComboItem -> ComboList
- ComboCount -> ComboListCount
- ComboIndex -> ComboListIndex
- Incremental search now enabled for the drop-down list when editing a cell.
15-May-2019
- Renaming of properties related to 13-May-2019 update
- EditDropDownList -> ComboList
- EditDroppedDown -> ComboDroppedDown
- hWndEditButton -> hWndComboButton
- hWndEditList -> hWndComboList
- Included ComboCount/ComboItem/ComboIndex run-time property that are valid when using drop-down combo lists.
- Included ComboDropDown/ComboCloseUp event.
- Included ColComboList run-time property. It works similar to the ComboList property, except it applies to entire columns.
14-May-2019
- Eliminated run-time limitation of no support for having fixed cell(s) without cell(s). (e.g. FixedRows = 1 and Rows = 1)
13-May-2019
- Included the EditDropDownList/EditDroppedDown run-time property that allows to use a drop-down list when editing a cell.
10-May-2019
- Finetuning concerning RightToLeftLayout for in-cell editing window.
09-May-2019
- Bugfix related to 08-May-2019 update.
08-May-2019
- Major drawing performance boost. (~20%)
07-May-2019
- Bugfix related to 06-May-2019 update concerning in-cell editing window.
06-May-2019
- When in-cell editing window is scrolled off then any key input will now bring it back into view.
- Included WS_CLIPCHILDREN on VBFlexGridWndClass creation.
05-May-2019
- Included enum FlexSelectionModeFreeByRow and FlexSelectionModeFreeByColumn in the SelectionMode property.
01-May-2019
- Row/Col params in the BeforeEdit event now ByRef instead ByVal.
25-Apr-2019
- Finetuning with WM_NCCALCSIZE/WM_NCHITTEST/WM_NCPAINT for in-cell editing window.
23-Apr-2019
- Bugfix in the internal FlexTopParentValidateControls function.
17-Apr-2019
- Bugfix related to 15-Apr-2019 update when scrolling while editing fixed cells.
- Finetuning with EM_SETMARGINS for in-cell editing window.
15-Apr-2019
- Scrolling will now update the in-cell editing window accordingly.
13-Apr-2019
- Included the in-cell editing functionality.
- AllowUserEditing property.
- StartEdit/CancelEdit/CommitEdit method. (works even if AllowUserEditing is False)
- BeforeEdit/EnterEdit/ValidateEdit/LeaveEdit/AfterEdit events.
- EditSetupStyle/EditSetupWindow/EditQueryClose/EditChange/EditKeyDown/EditKeyUp/EditKeyPress events.
- hWndEdit/EditRow/EditCol/EditReason/EditCloseMode read-only run-time property.
- EditText/EditMaxLength/EditSelStart/EditSelLength/EditSelText run-time property.
- Included the IMEMode property.
- Included the GetMergedRange method.
12-Apr-2019
- Merged cells are now able to fetch custom data source 'FlexDataSource'.
11-Apr-2019
- Minor modification in the internal ProcessKeyDown method.
10-Apr-2019
- Minor modification in the WM_LBUTTONDOWN handler.
04-Apr-2019
- Included optional parameter Row and Col in the CellEnsureVisible method.
So instead the current cell an arbitrary cell can now be ensured to be visible, scrolling if necessary.
03-Apr-2019
- Bugfix in CellWrapBehavior property.
It didn't work as expected when there were hidden or zero height/width rows/cols.
02-Apr-2019
- Bugfix in FormatString property when no alignment prefix for a column was specified.
FlexAlignmentGeneral is now used then instead of FlexAlignmentLeftCenter.
26-Mar-2019
- Minor bugfix in the WM_MOUSEACTIVATE handler.
24-Mar-2019
- Compatibility fix for the CellWidth/CellHeight property.
18-Mar-2019
- Internal performance improvement.
10-Mar-2019
- Improvement in VTableHandle.bas concerning 'DeactivateIPAO'.
02-Mar-2019
- More user friendly behavior when SelectionMode is ByRow/ByCol and pressing cursor keys.
26-Feb-2019
- Included the CellClick and CellDblClick event.
30-Jan-2019
- CellPicture property can now render 32bpp alpha bitmaps.
23-Jan-2019
- VBA bugfix.
17-Jan-2019
- Improvement in VTableHandle.bas concerning 'DeactivateIPAO'.
09-Nov-2018
- Internal improvement concerning design-mode handling.
26-Oct-2018
- Bugfix related to 25-Oct-2018 update.
- Minor internal improvements.
25-Oct-2018
- Internal improvement concerning divider drag of the last row or col.
09-Oct-2018
- WM_SYSKEYDOWN/WM_SYSKEYUP considered now for KeyDown/KeyUp events.
04-Oct-2018
- RowID/RowIndex property included. The usage is similar to the ColKey/ColIndex property.
RowIndex returns a row given its ID, whereas RowID returns/sets the ID given its row.
27-Sep-2018
- Included the SingleLine property.
12-Sep-2018
- Included optional argument Direction in the FindItem function. Also FindItem cannot be used anymore on a fixed row.
11-Sep-2018
- Included the FlexDataSource property (run-time only) to set a custom data source which fetches data from the IVBFlexDataSource interface.
It comes along with several limitations (e.g. cannot use .Sort) and the behavior/definitions are similar to the IVSFlexDataSource from VSFlexGrid.
- Included the DataRefresh method which forces the control to re-fetch all data from its data source. (and/or custom data source)
- Included optional argument Wrap in the FindItem function.
- The AddItem method now respects the ClipMode property setting.
04-Sep-2018
- Included optional argument ExcludeHidden in the FindItem function.
- Added WS_EX_TRANSPARENT for the internal tooltip control which solved two issues:
- The control did not receive focus when clicking on a tip from another control.
- In Win10 the mouse wheel will scroll even if the mouse hovers over a tip. (in-place tip)
03-Sep-2018
- Bugfix in the Cell property for FlexCellSort setting.
27-Aug-2018
- Further optimization of the internal GetHitTestInfo function.
26-Aug-2018
- Major performance boost for internal GetHitTestInfo function.
12-Aug-2018
- TEXTMETRIC structure was declared as ANSI. Fixed to WIDE version.
Unicode did not lack due to this bug, but it was a memory risk as WIDE version is larger than ANSI.
28-Jul-2018
- Internal GDI leak fixed. (forgot to restore old font handle in a hDCScreen)
09-Jul-2018
- Bugfix in the WrapCellBehavior property. Bug only affected when SelectionMode was ByRow or ByColumn.
02-May-2018
- Renamed enum 'FlexClipModeIncludeHidden' to 'FlexClipModeNormal'.
- Included optional argument ExcludeHidden in the AutoSize method.
22-Apr-2018
- Included the ClipMode property that controls whether to include or exclude hidden cells in a clip command.
20-Apr-2018
- Internal bugfix in page scroll up and down in relation to zero width rows.
- WM_LBUTTONDOWN intercepted (no MouseDown event) in case of divider row/col dragging.
This is the same behavior as in the original MS(H)FlexGrid.
16-Apr-2018
- Bugfix in the CellFontName property, related to update on 05-Dec-2017. (This bug had only effect when FillStyle is set to FlexFillStyleRepeat)
14-Mar-2018
- Optimized the divider row/col dragging.
- Included the HitRowDivider/HitColDivider property which returns the divider row/col from the last invoked .HitTest.
The divider row/col contains already the necessary offset for FlexHitResultDividerRowTop and FlexHitResultDividerColumnLeft.
In addition the offset includes hidden rows/cols. (zero width rows/cols are not offset to preserve MSFlexGrid compatibility)
13-Mar-2018
- Included the DividerDblClick event.
09-Mar-2018
- Bugfix related to custom sorting bugfix on 08-Mar-2018.
08-Mar-2018
- Critical bugfix for custom sorting. (FlexSortCustom)
- Included enum FlexSortCurrencyAscending/FlexSortCurrencyDescending and FlexSortDateAscending/FlexSortDateDescending in Sort/ColSort property.
04-Mar-2018
- Bugfix in VTableHandle.bas related to 25-Feb-2018 update. (concerns unload stability in IDE only)
25-Feb-2018
- Major internal improvement in the VTableHandle.bas concerning IOleInPlaceActiveObject.
20-Feb-2018
- Unicode support when generating ASCII key combos, e.g. ALT + 3333.
11-Feb-2018
- Included the AutoSize method.
23-Jan-2018
- Included the TextWidth/TextHeight function that calculates for the current or an arbitrary cell the width and height length.
For multiline text the heights are cumulated and for the width the line with the greatest width is taken. Similar to VB.Form's TextWidth function.
21-Dec-2017
- Improved the WM_MOUSEWHEEL handler for fine-grained wheel changes.
09-Dec-2017
- Improved VTableHandle.bas so it does not crash anymore when using VBCCRxx.OCX and VBFLXGRDxx.OCX in paralell. (concerns ActiveX control only)
05-Dec-2017
- Major performance fix. (Caused by update on 23-Nov-2017)
- Bugfix in the CellFontName property.
A change will now overwrite the CellFontCharset settings.
23-Nov-2017
- Final tweak to run in the VBA environment. (meaningful for OCX only)
22-Nov-2017
- Minor internal improvements.
18-Nov-2017
- Bugfix for generic sorting.
27-Oct-2017
- Again minor tweaks to run better in the VBA environment. (meaningful for OCX only)
20-Oct-2017
- Minor tweaks to run better in the VBA environment. (meaningful for OCX only)
26-Sep-2017
- Included the BeforeMouseDown event.
The event is identical as in the MouseDown event, but an additional Cancel parameter allows you to prevent the default processing.
22-Sep-2017
- Minor bugfix in the internal GetHitTestInfo function.
19-Sep-2017
- Included the FormatString property.
- Bugfix that the FixedAlignment returned not the ColAlignment when not preset.
- FixedAlignment accepts now a value of -1 so that it is not preset anymore.
17-Sep-2017
- The Rows/Cols property can now be set lower or equal to the FixedRows/FixedCols property without raising an error.
Like in the MS(H)FlexGrid the FixedRows/FixedCols property will be adjusted then accordingly.
02-Sep-2017
- The Font property is not written to the property bag anymore when it equals to Ambient.Font.
Included new function OLEFontIsEqual in Common.bas.
01-Sep-2017
- Included the ClipSeparators property which enables to define two custom distinct characters to be used in clip strings.
26-Aug-2017
- Alpha (32bpp) icons in 'CellPicture' now drawn correctly per DrawIconEx instead of Picture.Render.
07-Aug-2017
- The HelpContextID and WhatsThisHelpID property is now also available when setting to a shadow object. ('Set' command)
27-Jul-2017
- Internal "DPI Aware" improvements.
Improved the functions PixelsPerDIP_X/PixelsPerDIP_Y in Common.bas.
25-Jul-2017
- Pixels in the property bag are now treated as DIPs. (Device-independent pixels)
There is no compatibility break in the property bag when there were saved at 100% (96) DPI.
Included new functions PixelsPerDIP_X/PixelsPerDIP_Y in Common.bas.
This "DPI Aware" enhancement affects the RowHeightMin/RowHeightMax and ColWidthMin/ColWidthMax property.
24-Jul-2017
- Included the EllipsisFormatFixed property which enables the setting to be differentiated between fixed and non-fixed cells.
23-Jul-2017
- Included the DataSource/DataMember property which allows to bind an Adodc control, DateEnvironment designer or ADODB.Recordset object.
A reference to the msdatsrc.tlb (pre-installed since Win2k) is required.
The new conditional compiliation constant 'ImplementDataSource' controls if the new feature is turned on.
If turned off the 'DataBindingBehavior' might be changed back from 'vbComplexBound' to 'vbNone'.
[...]
14-Jun-2017
- First release.