Results 1 to 4 of 4

Thread: EGrid Control - Imitates Microsoft Excel

Threaded View

  1. #1

    Thread Starter
    Addicted Member cheesebrother's Avatar
    Join Date
    Jul 2011
    Posts
    153

    EGrid Control - Imitates Microsoft Excel

    EGrid is a simple grid control that imitates Microsoft excel. No, it isn’t an
    amazing control created by a burst of inspiration; I made it simply because
    grids are incredibly useful. EGrid functions like Excel in how it selects, edits,
    copies and pastes text in different cells. Yes, being like Excel in how it
    copies and pastes means that it can copy, cut, and paste between other
    EGrid controls and also Excel! The grid is very flexible and allows you to
    change all kinds of column, row, and cell properties etc. It uses GDI and
    makes its own region so if for some reason you decide to hide a cell in the
    middle of the grid there will be transparent hole.

    For each cell in the grid there is a Text property and also others which give
    you control of the cell. The font, color, and alignment properties allow you
    to control the appearance of each individual cell. You can also hide cells if
    you want to which makes a hole in the grid. Since grids usually deal with a
    lot of numbers the control can filter input, allowing only numbers. It also
    allows limits to be created which limit the amount of spaces before and after
    the decimal point. A validation format property is also there to that you can
    set a string which will format a cell’s contents with when it looses focus.


    The way that the grid’s filter works is kind of special and you’ll need to know
    what you’re doing to be able to set it. Instead of adding about five
    properties to the control I made it so that it can read strings that hold all the
    information. Use + to turn the filter on and anything else to turn it off. In
    order to make it an integer use “int”. Here are some examples:

    “+00000.00” ‘A filter that allows five places before the decimal and 2 after
    “+Int” ‘An integer filter
    “+Int000” ‘An integer filter that allows three places
    “-” ‘Turns the filter off
    “ASeljaeLaer” ‘Also turns the filter off


    The grid has ways of loading and saving its data which includes loading and
    saving CSV files, loading from and making double arrays, and also reading
    from and writing text strings (these text strings are written in the format
    that is used for copy/paste).


    These are all of the control’s properties. All of them are Read/Write.
    Grid Properties:
    -Columns – The amount of columns in the grid
    -HideNumbers – Hides the row numbers that are on the left
    -NumFilter – Limits the control’s input to only numbers (this must be enabled for CelFilter and
    NegativeNums to work)
    -NegativeNums – Allows negative numbers to be typed into the control
    -Rows – The amount of rows in the grid

    Column Properties:
    -ColCaption– Sets a column’s caption
    -ColClip – Determines the amount of cells that are clipped in a selection (this is kind of complicated and is demonstrated in one of the examples)
    -ColTop – Sets the top of a column (basically the height of the caption’s area)
    -ColWidth – Sets the width of a column

    Row Properties:
    -CustomRowCaption - Sets whether sequential numbers or custom text will be the row's caption on the left
    -RowCapAlign - Sets the alignment of the left captions
    -RowCaption - Sets arows caption
    -RowHeight – Sets the height of a row
    -RowNumWidth – Sets the width of the rows’ numbers on the left


    Cell Properties:
    -CelAlignment – Sets the alignment of a cell
    -CelButton - Sets what kind of control the cell is
    -CelColor – Sets the color of a cell’s text
    -CelFont – Sets a cell’s font (can only change at runtime)
    -CelFilter – Sets the filter string of a cell
    -CelLocked – Sets whether a cell is editable
    -CelSelectColor – Sets a cell’s selected color
    -CelText – Sets a cell’s text
    -CelValFormat – Sets the validation format string for a cell
    -CelVisible – Sets a cell’s visibility

    These are the subs and functions which the control has
    -AddColumn – Adds a column to the grid
    -AddRow – Adds a row to the grid
    -ArrayFromString – Creates a double array from a string
    -ArrayToString – Makes a string from a double array
    -CloseText – Closes the textbox if it is open
    -ContentsFromString – Loads the cell’s contents from a string
    -ContentsToString – Makes a string from the cell’s contents
    -CurrentFocusX – Returns the x of the cell that has main focus
    -CurrentFocusY – Returns the y of the cell that has main focus
    -DeleteAll – Deletes the cell’s contents
    -LoadCSV – Opens a dialog box which loads the control’s contents from a CSV file
    -SaveCSV – Opens a dialog box which saves the control’s contents to a CSV file
    -ShowColMenu – Shows the column’s Add/Remove popupmenu
    -ShowRowMenu – Shows the row’s Add/Remove popupmenu
    -UpdateControl – Remakes region and redraws control
    -RemoveColumn – Removes a column from the grid
    -RemoveRow – Removes a row from the grid

    Updates
    As of now the grid isn’t completely solid and after using it for a bit you might
    find a bug. If you notify me about it I’ll be happy to fix it. If you have any
    suggestions for enhancements to the control I’ll consider them and update
    the control.
    Attached Images Attached Images   
    Attached Files Attached Files
    Last edited by Hack; Nov 23rd, 2011 at 08:47 AM. Reason: Removed Compiled Code From Attachment
    Hooked for good.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width