LiteGrid Control

Presented ActiveX control encapsulates spreadsheet functionality and is very similar to MS FlexGrid control. Why I decided to create my own control? The answer is obvious: because I didn't like existing. Users of my projects are mainly accountants with relatively weak hardware: 486s with 8-12MB RAM. MS FlexGrid works on this platform, but scrolls too slowly to be convenient.

Presented ActiveX control was implemented using ATL 2.0 and VC++ 5 SP3. It has relatively small executable size (approximately 55 KB + 22 KB atl.dll instead of 223 KB of MS FlexGrid) and much higher scrolling speed than MS FlexGrid. Also it supports inplace text editing in cells. Of course it does not implement many MS FlexGrid's features - such as cell merging, custom effects for text etc. But it has enough features to work in real projects. Also because of it's small size LiteGrid control can be used in HTML pages.

Properties

Name Type Description
FixedRows long Number of fixed rows in the grid
FixedCols long Number of fixed columns in the grid
Rows long Number of rows in the grid
Cols long Number of columns in the grid
CellText(r,c) BSTR Contents of any cell within the grid. r - row, c - column (Rows and columns start with 0)
ColWidth(c) long Width of a column in the grid in pixels. c - column number
RowHeight(r) long Height of a column in the grid in pixels. r - row number
DefaultColWidth long Default width of a column in pixels. When new columns added to the grid, their width is set to this value
DefaultRowHeight long Default height of a row in pixels. When new rows added to the grid, their height is set to this value
Row long The row of currently selected (active) cell
Col long The column of currently selected (active) cell
FixedFont LPFONTDISP Font which is used to draw fixed cells
NormalFont LPFONTDISP Font which is used to draw normal cells
FixedBkColor OLE_COLOR Color of fixed cell's background
NormalColor OLE_COLOR Color of normal cell's background
FixedTextColor OLE_COLOR Color of text in fixed cells
NormalTextColor OLE_COLOR Color of text in normal cells
FixedLightColor OLE_COLOR Color of a fixed cell's light edge
FixedShadowColor OLE_COLOR Color of a fixed cell's shadow edge
NormalLightColor OLE_COLOR Color of a normal cell's light edge
NormalShadowColor OLE_COLOR Color of a normal cell's shadow edge
CellTop long Top coordinate of the selected cell in pixels. Read only
CellLeft long Left coordinate of the selected cell in pixels. Read only
CellWidth long Width of the selected cell in pixels. Read only
CellHeight long Height of the selected cell in pixels
ResizeRows VARIANT_BOOL Enables/disables rows resizing with mouse
ResizeCols VARIANT_BOOL Enables/disables columns resizing with mouse
Editable VARIANT_BOOL Enables/disables inplace editing
ScrollBars SCROLL_BAR_TYPE Changes scroll bars set (lgBothScrollBars, lgHorzScrollBar, lgVertScrollBar, lgNonScrollBars)
FastDraw VARIANT_BOOL Enables/disables grid changes buffering for fast scrolling (if this option turned on (TRUE) LiteGrid shows three times faster scrolling then MS FlexGrid, if not - only 25-30% faster than MS FlexGrid. These results were achieved on P133, S3 Trio. Grids had 1000 rows, 20 columns (9 visible)
ColAlign(c) lgColAlignType Align of text in a column. c - column number. Can be lgAlignLeft, lgAlignCenter, lgAlignRight.
DefaultColAlign lgColAlignType Default align of text in a column. When new columns are added to the LiteGrid, they have this text align.

Methods

Name Return type Description
GetFixedTextWidth(bsText) long Returns width in pixels of BSTR bsText for fixed cells
GetNormalTextWidth(bsText) long Returns width in pixels of BSTR bsText for normal cells

Events

Name Description
MouseMove See VB documentation for this event. Coordinates are given in pixels
MouseDown See VB documentation for this event. Coordinates are given in pixels
Click See VB documentation for this event
KeyDown See VB documentation for this event
KeyUp See VB documentation for this event
KeyPress See VB documentation for this event
CellChanging (r,c) Fired before active cell changes. r indicates new row of selected cell, c - new column
CellChanged Fired after active cell has changed
StartEditing(*b) Fired before inplace editing. you can assign *b (VARIANT_BOOL type) FALSE to disallow this editing
EndEditing(bs,*b) Fired after inplace editing, but before entered text has moved to selected cell. bs (BSTR type) has text string which a user just typed into inplace editor, you also can assign *b (VARIANT_BOOL type) FALSE to prevent writing this data to cell.

I hope that this control can be useful for many programmers, and you can freely use it in your projects. Drawing speed can be even more improved by using Poly... GDI functions instead of single calls: MS promises much faster drawing speed when using these functions. And at last, if you have suggestions, notes or bug reports please contact me at chandiv@users.univers.cv.ua or ivannikov@altavista.net (the first address will be closed soon)

Downloads

Download demo project - 8 Kb


Comments

  • query

    Posted by Legacy on 11/09/2003 12:00am

    Originally posted by: rudresh

    is it possible for editting the flexgrid in visual basic
    

    Reply
  • yet to come

    Posted by Legacy on 09/13/2003 12:00am

    Originally posted by: VISHAL JOSHI

    yet to come the full version , wait !

    Reply
  • How To print flexgrid to the printer

    Posted by Legacy on 05/30/2003 12:00am

    Originally posted by: james

    Reply
  • flexgid

    Posted by Legacy on 04/25/2003 12:00am

    Originally posted by: khalid khan

    using checkbox in flexgrid in vc++

    Reply
  • how to print flexgrid & see its preview

    Posted by Legacy on 01/20/2003 12:00am

    Originally posted by: mayur

    hello
    pls anyone help me to print flexgrid directly on the printer
    & t see its preview

    Reply
  • How to print the data in the flexgrid

    Posted by Legacy on 09/05/2002 12:00am

    Originally posted by: Hero

    As the title

    Reply
  • How can I solve this problem?

    Posted by Legacy on 04/22/2002 12:00am

    Originally posted by: Jason Chang

    Hi, everybody.
    
    I encountered an error when I compiled the resources.
    It says:
    vctest.rc(20) : fatal error RC4214: Codepage not valid: ignored

    How can I get it corrected? Thank you in advance.

    Reply
  • Comments from author...

    Posted by Legacy on 11/09/2001 12:00am

    Originally posted by: Andrew Ivannikov

    Hi there!
    Thanks to all looking at/testing/using the control! Yes it has bugs - and I don't really have time to fiddle with it. The code is open, there is no license, everything is free (although commercial products using LiteGrid should mention my modest person) - anybody can tailor it to suit particular needs! So anybody is welcome to improve/add more functionality and of course fix the bugs. But while adding new features don't forget about "Lite" naturte of the grid ;) I am dropping this project.

    Regards
    Andrew

    Reply
  • Help with Control in a Dialog

    Posted by Legacy on 05/20/2001 12:00am

    Originally posted by: Sandeep lal

    Great control your LiteGrid . I am trying to use it in a Dialog, but get an ASSERT Faliure from winocc.cpp. Apparently it fails in CWND::SetFocus() Function. Have you used your control in a Dialog? Your example of using it in a CView works fine.

    Thanks,

    Sandeep

    Reply
  • highlight color

    Posted by Legacy on 02/19/2000 12:00am

    Originally posted by: ttssiong

    hi, i met a problem here
    
    where i setCellTest into the liteGrid
    i found that the text in the highlight cell can not be seen
    And one more problem here, i put several litegrid into several form view which i will switch within one frame
    when i switch back to the form view that contains the litegrid, the text i store insides lost ...

    can u help me ?
    this is urgent cos my final year project will due soon.

    Reply
  • Loading, Please Wait ...

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • This ESG study by Mark Peters evaluated a common industry-standard disk VTl deduplication system (with 15:1 reduction ratio) versus a tape library with LTO-5, drives with full nightly backups, over a five-year period.  The scenarios included replicated systems and offsite tape vaults.  In all circumstances, the TCO for VTL with deduplication ranged from about 2 to 4 times more expensive than the LTO-5 tape library TCO. The paper shares recent ESG research and lots more. 

  • Learn how cloud-based master data management (MDM) empowers your fast-paced business to get the right data to the right place in real time, so you can remain competitive and agile.

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds