Click here to Skip to main content
13,731,369 members
Click here to Skip to main content

Stats

3M views
19.9K downloads
995 bookmarked
Posted 19 Jan 2003
Licenced MIT

SourceGrid - Open Source C# Grid Control

, 4 Aug 2013
SourceGrid is a free open source grid control. Supports virtual grid, custom cells and editors, advanced formatting options and many others features
SourceGrid2
References
SourceLibrary.dll
vssver.scc
SampleProject
App.ico
bin
Release
SampleProject.exe
SourceGrid2.dll
SourceLibrary.dll
Extensions
Add.ico
ArrowDown.ICO
ArrowUp.ICO
Delete.ICO
Refresh.ico
vssver.scc
Samples
CalcioSmall.bmp
FACE00.ICO
FACE01.ICO
FACE02.ICO
FACE04.ICO
new.bmp
vssver.scc
SourceGrid
BehaviorModels
vssver.scc
bin
Release
SourceGrid2.dll
SourceLibrary.dll
vssver.scc
Cells
vssver.scc
Common
Icons
CheckBoxChecked.ico
CheckBoxCheckedDisable.ico
CheckBoxCheckedSel.ico
CheckBoxUnChecked.ico
CheckBoxUnCheckedDisable.ico
CheckBoxUnCheckedSel.ico
clear.ico
copy.ico
cut.ico
DeleteCol.ico
DeleteRow.ico
InsertCol.ico
InsertRow.ico
paste.ico
properties.ico
SortDown.ico
SortUp.ico
Thumbs.db
vssver.scc
vssver.scc
DataModels
vssver.scc
Grid.bmp
Grids
vssver.scc
GridVirtual.bmp
SourceGrid2.snk
VisualModels
vssver.scc
SourceGrid
DemoProject
App.ico
bin
Release
DemoProject.exe
SourceGrid.dll
SourceLibrary.dll
FACE00.ICO
FACE01.ICO
FACE02.ICO
FACE04.ICO
new.bmp
PropertyStyleGrid
WorksheetStyleGrid
References
SourceLibrary.dll
SourceGrid
bin
Release
SourceGrid.dll
Cells
Models
PropertyStyleGrid
SourceGrid.snk
TypeCreator
Utility
Chris.Beckett.MenuImageLib
SubItem16.ico
Control
Controls
Icons
CheckBoxChecked.ico
CheckBoxCheckedDisable.ico
CheckBoxCheckedSel.ico
CheckBoxUnChecked.ico
CheckBoxUnCheckedDisable.ico
CheckBoxUnCheckedSel.ico
clear.ico
copy.ico
cut.ico
DeleteCol.ico
DeleteRow.ico
InsertCol.ico
InsertRow.ico
paste.ico
properties.ico
SortDown.ico
SortUp.ico
WorksheetStyleGrid
using System;
using SourceGrid2.Cells;

namespace SourceGrid2
{
	/// <summary>
	/// A collection of elements of type ICellVirtual
	/// </summary>
	public class CellVirtualCollection: System.Collections.CollectionBase
	{
		/// <summary>
		/// Initializes a new empty instance of the CellBaseCollection class.
		/// </summary>
		public CellVirtualCollection()
		{
			// empty
		}

		/// <summary>
		/// Initializes a new instance of the CellBaseCollection class, containing elements
		/// copied from an array.
		/// </summary>
		/// <param name="items">
		/// The array whose elements are to be added to the new CellBaseCollection.
		/// </param>
		public CellVirtualCollection(ICellVirtual[] items)
		{
			this.AddRange(items);
		}

		/// <summary>
		/// Initializes a new instance of the CellBaseCollection class, containing elements
		/// copied from another instance of CellBaseCollection
		/// </summary>
		/// <param name="items">
		/// The CellBaseCollection whose elements are to be added to the new CellBaseCollection.
		/// </param>
		public CellVirtualCollection(CellVirtualCollection items)
		{
			this.AddRange(items);
		}

		/// <summary>
		/// Adds the elements of an array to the end of this CellBaseCollection.
		/// </summary>
		/// <param name="items">
		/// The array whose elements are to be added to the end of this CellBaseCollection.
		/// </param>
		public virtual void AddRange(ICellVirtual[] items)
		{
			foreach (ICellVirtual item in items)
			{
				this.List.Add(item);
			}
		}

		/// <summary>
		/// Adds the elements of another CellBaseCollection to the end of this CellBaseCollection.
		/// </summary>
		/// <param name="items">
		/// The CellBaseCollection whose elements are to be added to the end of this CellBaseCollection.
		/// </param>
		public virtual void AddRange(CellVirtualCollection items)
		{
			foreach (ICellVirtual item in items)
			{
				this.List.Add(item);
			}
		}

		/// <summary>
		/// Adds an instance of type ICellVirtual to the end of this CellBaseCollection.
		/// </summary>
		/// <param name="value">
		/// The ICellVirtual to be added to the end of this CellBaseCollection.
		/// </param>
		public virtual void Add(ICellVirtual value)
		{
			this.List.Add(value);
		}

		/// <summary>
		/// Determines whether a specfic ICellVirtual value is in this CellBaseCollection.
		/// </summary>
		/// <param name="value">
		/// The ICellVirtual value to locate in this CellBaseCollection.
		/// </param>
		/// <returns>
		/// true if value is found in this CellBaseCollection;
		/// false otherwise.
		/// </returns>
		public virtual bool Contains(ICellVirtual value)
		{
			return this.List.Contains(value);
		}

		/// <summary>
		/// Return the zero-based index of the first occurrence of a specific value
		/// in this CellBaseCollection
		/// </summary>
		/// <param name="value">
		/// The ICellVirtual value to locate in the CellBaseCollection.
		/// </param>
		/// <returns>
		/// The zero-based index of the first occurrence of the _ELEMENT value if found;
		/// -1 otherwise.
		/// </returns>
		public virtual int IndexOf(ICellVirtual value)
		{
			return this.List.IndexOf(value);
		}

		/// <summary>
		/// Inserts an element into the CellBaseCollection at the specified index
		/// </summary>
		/// <param name="index">
		/// The index at which the ICellVirtual is to be inserted.
		/// </param>
		/// <param name="value">
		/// The ICellVirtual to insert.
		/// </param>
		public virtual void Insert(int index, ICellVirtual value)
		{
			this.List.Insert(index, value);
		}

		/// <summary>
		/// Gets or sets the ICellVirtual at the given index in this CellBaseCollection.
		/// </summary>
		public virtual ICellVirtual this[int index]
		{
			get
			{
				return (ICellVirtual) this.List[index];
			}
			set
			{
				this.List[index] = value;
			}
		}

		/// <summary>
		/// Removes the first occurrence of a specific ICellVirtual from this CellBaseCollection.
		/// </summary>
		/// <param name="value">
		/// The ICellVirtual value to remove from this CellBaseCollection.
		/// </param>
		public virtual void Remove(ICellVirtual value)
		{
			this.List.Remove(value);
		}

		/// <summary>
		/// Type-specific enumeration class, used by CellBaseCollection.GetEnumerator.
		/// </summary>
		public class Enumerator: System.Collections.IEnumerator
		{
			private System.Collections.IEnumerator wrapped;

			/// <summary>
			/// 
			/// </summary>
			/// <param name="collection"></param>
			public Enumerator(CellVirtualCollection collection)
			{
				this.wrapped = ((System.Collections.CollectionBase)collection).GetEnumerator();
			}

			/// <summary>
			/// 
			/// </summary>
			public ICellVirtual Current
			{
				get
				{
					return (ICellVirtual) (this.wrapped.Current);
				}
			}

			/// <summary>
			/// 
			/// </summary>
			object System.Collections.IEnumerator.Current
			{
				get
				{
					return (ICellVirtual) (this.wrapped.Current);
				}
			}

			/// <summary>
			/// 
			/// </summary>
			/// <returns></returns>
			public bool MoveNext()
			{
				return this.wrapped.MoveNext();
			}

			/// <summary>
			/// 
			/// </summary>
			public void Reset()
			{
				this.wrapped.Reset();
			}
		}

		/// <summary>
		/// Returns an enumerator that can iterate through the elements of this CellBaseCollection.
		/// </summary>
		/// <returns>
		/// An object that implements System.Collections.IEnumerator.
		/// </returns>        
		public new virtual CellVirtualCollection.Enumerator GetEnumerator()
		{
			return new CellVirtualCollection.Enumerator(this);
		}
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The MIT License

Share

About the Author

Davide Icardi
Software Developer
Italy Italy
No Biography provided

You may also be interested in...

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web06-2016 | 2.8.180920.1 | Last Updated 4 Aug 2013
Article Copyright 2003 by Davide Icardi
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid