Click here to Skip to main content
13,801,259 members
Click here to Skip to main content

Stats

3M views
20.1K 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 System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace DemoProject
{
	/// <summary>
	/// Summary description for frmSampleCellControl.
	/// </summary>
	public class frmSampleCellControl : System.Windows.Forms.Form
	{
		private SourceGrid.Grid grid1;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public frmSampleCellControl()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.grid1 = new SourceGrid.Grid();
			this.SuspendLayout();
			// 
			// grid1
			// 
			this.grid1.AutoSizeMinHeight = 20;
			this.grid1.AutoSizeMinWidth = 20;
			this.grid1.BackColor = System.Drawing.Color.White;
			this.grid1.CellsContainerCursor = System.Windows.Forms.Cursors.Default;
			this.grid1.CellsContainerToolTipText = "";
			this.grid1.Cols = 0;
			this.grid1.CustomScrollArea = new System.Drawing.Size(0, 0);
			this.grid1.CustomScrollPosition = new System.Drawing.Point(0, 0);
			this.grid1.Dock = System.Windows.Forms.DockStyle.Fill;
			this.grid1.FixedCols = 0;
			this.grid1.FixedRows = 0;
			this.grid1.GridScrollPosition = new System.Drawing.Point(0, 0);
			this.grid1.Name = "grid1";
			this.grid1.Rows = 0;
			this.grid1.Size = new System.Drawing.Size(456, 403);
			this.grid1.TabIndex = 0;
			this.grid1.ToolTipActive = true;
			// 
			// frmSampleCellControl
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(456, 403);
			this.Controls.AddRange(new System.Windows.Forms.Control[] {
																		  this.grid1});
			this.Name = "frmSampleCellControl";
			this.Text = "Sample Cell Control";
			this.Load += new System.EventHandler(this.frmSampleCellControl_Load);
			this.ResumeLayout(false);

		}
		#endregion

		private void frmSampleCellControl_Load(object sender, System.EventArgs e)
		{
			grid1.Rows = 101;
			grid1.Cols = 4;
			grid1.BackColor = Color.FromKnownColor(KnownColor.Control);
			grid1.SetColWidth(0,100);
			grid1.SetColWidth(1,100);
			grid1.SetColWidth(2,100);
			grid1.SetColWidth(3,100);
			grid1[0,0] = new SourceGrid.CellHeader("DateTimePicker");
			grid1[0,1] = new SourceGrid.CellHeader("ComboBox");
			grid1[0,2] = new SourceGrid.CellHeader("CheckBox");
			grid1[0,3] = new SourceGrid.CellHeader("Button");

			for (int r = 1; r < grid1.Rows; r++)
			{
				grid1[r,0] = new SourceGrid.CellControl(new DateTimePicker());
				grid1[r,1] = new SourceGrid.CellControl(new ComboBox());
				grid1[r,2] = new SourceGrid.CellControl(new CheckBox());
				grid1[r,3] = new SourceGrid.CellControl(new Button());
			}

			grid1.RecalcCustomScrollBars();
		}
	}
}

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
Web01 | 2.8.181215.1 | Last Updated 4 Aug 2013
Article Copyright 2003 by Davide Icardi
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid