Results 1 to 4 of 4

Thread: EGrid Control - Imitates Microsoft Excel

  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.

  2. #2

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

    Re: EGrid Control - Imitates Microsoft Excel

    Ok, I’ve updated the attachment with the new eGrid. This is a BIG jump from the last one. Besides lots and lots of bug fixes and teaks, the control has some new features. You can now make a cell any control you wish : Textbox, Commandbutton, Checkbox, Optionbox, and last of all a combobox. This is set by the new property called “CelButton” and is also accessible in the property page. When the cell doesn’t have focus it is simply a grey background, however when it does have focus it get’s its complete look. A new event entitled “CelClick” allows you to work with these new things. Another thing is that option explicit now occupies the first line of the usercontrol. This means that lots of unnecessary variables have been taken out and the rest dimensioned. Last but not least the final new feature is that you can make the captions on the left whatever you like (there’s a property to switch between numbers and custom). The “LineGS” class module (which I got from planetsourcecode) is included as well for use in drawing the checkbox and optionbox. I hope you like the updates and please, tell me what you think of my control.
    Hooked for good.

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: EGrid Control - Imitates Microsoft Excel

    Thank you for your CodeBank submission.

    Per this CodeBank policy, I have edited your attachment and removed all compiled code.

    We welcome and appreciate all entries into our Codebank and require that source code only be included with anything attached.

    Thank you.

  4. #4

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

    Re: EGrid Control - Imitates Microsoft Excel

    I have edited your attachment and removed all compiled code.
    Thanks, I forgot that .exe from when i was testing.
    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