本文整理汇总了C#中System.Windows.Forms.DataGrid类的典型用法代码示例。如果您正苦于以下问题:C# DataGrid类的具体用法?C# DataGrid怎么用?C# DataGrid使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataGrid类属于System.Windows.Forms命名空间,在下文中一共展示了DataGrid类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Run
public override void Run(ServiceController[] services, Form mainForm, DataGrid serviceGrid)
{
var addedMachine = QuickDialog2.DoQuickDialog("Add A Machine's Services", "Machine Name:",".","Pattern ^(Enable|EPX):","");
if (addedMachine != null)
{
MachineName = addedMachine[0];
this.SearchPattern = addedMachine[1];
try
{
DataGrid dgrid = serviceGrid;
this.addView = (DataView)dgrid.DataSource;
CurrencyManager bm = (CurrencyManager)dgrid.BindingContext[this.addView];
ArrayList arrSelectedRows = new ArrayList();
this.addView = (DataView)bm.List;
mainForm.Invoke(new InvokeDelegate(this.AddMachineInGUIThread));
serviceGrid.Refresh();
}
finally
{
addedMachine = null;
addView = null;
}
}
}
开发者ID:kcsampson,项目名称:Kexplorer,代码行数:33,代码来源:AddMachineScript.cs
示例2: DataGridAutoFormatDialog
internal DataGridAutoFormatDialog(DataGrid dgrid)
{
this.dgrid = dgrid;
base.ShowInTaskbar = false;
this.dataSet.Locale = CultureInfo.InvariantCulture;
this.dataSet.ReadXmlSchema(new XmlTextReader(new StringReader("<xsd:schema id=\"pulica\" xmlns=\"\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\"><xsd:element name=\"Scheme\"><xsd:complexType><xsd:all><xsd:element name=\"SchemeName\" minOccurs=\"0\" type=\"xsd:string\"/><xsd:element name=\"SchemePicture\" minOccurs=\"0\" type=\"xsd:string\"/><xsd:element name=\"BorderStyle\" minOccurs=\"0\" type=\"xsd:string\"/><xsd:element name=\"FlatMode\" minOccurs=\"0\" type=\"xsd:string\"/><xsd:element name=\"Font\" minOccurs=\"0\" type=\"xsd:string\"/><xsd:element name=\"CaptionFont\" minOccurs=\"0\" type=\"xsd:string\"/><xsd:element name=\"HeaderFont\" minOccurs=\"0\" type=\"xsd:string\"/><xsd:element name=\"AlternatingBackColor\" minOccurs=\"0\" type=\"xsd:string\"/><xsd:element name=\"BackColor\" minOccurs=\"0\" type=\"xsd:string\"/><xsd:element name=\"BackgroundColor\" minOccurs=\"0\" type=\"xsd:string\"/><xsd:element name=\"CaptionForeColor\" minOccurs=\"0\" type=\"xsd:string\"/><xsd:element name=\"CaptionBackColor\" minOccurs=\"0\" type=\"xsd:string\"/><xsd:element name=\"ForeColor\" minOccurs=\"0\" type=\"xsd:string\"/><xsd:element name=\"GridLineColor\" minOccurs=\"0\" type=\"xsd:string\"/><xsd:element name=\"GridLineStyle\" minOccurs=\"0\" type=\"xsd:string\"/><xsd:element name=\"HeaderBackColor\" minOccurs=\"0\" type=\"xsd:string\"/><xsd:element name=\"HeaderForeColor\" minOccurs=\"0\" type=\"xsd:string\"/><xsd:element name=\"LinkColor\" minOccurs=\"0\" type=\"xsd:string\"/><xsd:element name=\"LinkHoverColor\" minOccurs=\"0\" type=\"xsd:string\"/><xsd:element name=\"ParentRowsBackColor\" minOccurs=\"0\" type=\"xsd:string\"/><xsd:element name=\"ParentRowsForeColor\" minOccurs=\"0\" type=\"xsd:string\"/><xsd:element name=\"SelectionForeColor\" minOccurs=\"0\" type=\"xsd:string\"/><xsd:element name=\"SelectionBackColor\" minOccurs=\"0\" type=\"xsd:string\"/></xsd:all></xsd:complexType></xsd:element></xsd:schema>")));
this.dataSet.ReadXml(new StringReader("<pulica><Scheme><SchemeName>Default</SchemeName><SchemePicture>default.bmp</SchemePicture><BorderStyle></BorderStyle><FlatMode></FlatMode><CaptionFont></CaptionFont><Font></Font><HeaderFont></HeaderFont><AlternatingBackColor></AlternatingBackColor><BackColor></BackColor><CaptionForeColor></CaptionForeColor><CaptionBackColor></CaptionBackColor><ForeColor></ForeColor><GridLineColor></GridLineColor><GridLineStyle></GridLineStyle><HeaderBackColor></HeaderBackColor><HeaderForeColor></HeaderForeColor><LinkColor></LinkColor><LinkHoverColor></LinkHoverColor><ParentRowsBackColor></ParentRowsBackColor><ParentRowsForeColor></ParentRowsForeColor><SelectionForeColor></SelectionForeColor><SelectionBackColor></SelectionBackColor></Scheme><Scheme><SchemeName>Professional 1</SchemeName><SchemePicture>professional1.bmp</SchemePicture><CaptionFont>Verdana, 10pt</CaptionFont><AlternatingBackColor>LightGray</AlternatingBackColor><CaptionForeColor>Navy</CaptionForeColor><CaptionBackColor>White</CaptionBackColor><ForeColor>Black</ForeColor><BackColor>DarkGray</BackColor><GridLineColor>Black</GridLineColor><GridLineStyle>None</GridLineStyle><HeaderBackColor>Silver</HeaderBackColor><HeaderForeColor>Black</HeaderForeColor><LinkColor>Navy</LinkColor><LinkHoverColor>Blue</LinkHoverColor><ParentRowsBackColor>White</ParentRowsBackColor><ParentRowsForeColor>Black</ParentRowsForeColor><SelectionForeColor>White</SelectionForeColor><SelectionBackColor>Navy</SelectionBackColor></Scheme><Scheme><SchemeName>Professional 2</SchemeName><SchemePicture>professional2.bmp</SchemePicture><BorderStyle>FixedSingle</BorderStyle><FlatMode>True</FlatMode><CaptionFont>Tahoma, 8pt</CaptionFont><AlternatingBackColor>Gainsboro</AlternatingBackColor><BackColor>Silver</BackColor><CaptionForeColor>White</CaptionForeColor><CaptionBackColor>DarkSlateBlue</CaptionBackColor><ForeColor>Black</ForeColor><GridLineColor>White</GridLineColor><HeaderBackColor>DarkGray</HeaderBackColor><HeaderForeColor>Black</HeaderForeColor><LinkColor>DarkSlateBlue</LinkColor><LinkHoverColor>RoyalBlue</LinkHoverColor><ParentRowsBackColor>Black</ParentRowsBackColor><ParentRowsForeColor>White</ParentRowsForeColor><SelectionForeColor>White</SelectionForeColor><SelectionBackColor>DarkSlateBlue</SelectionBackColor></Scheme><Scheme><SchemeName>Professional 3</SchemeName><SchemePicture>professional3.bmp</SchemePicture><BorderStyle>None</BorderStyle><FlatMode>True</FlatMode><CaptionFont>Tahoma, 8pt, style=1</CaptionFont><HeaderFont>Tahoma, 8pt, style=1</HeaderFont><Font>Tahoma, 8pt</Font><AlternatingBackColor>LightGray</AlternatingBackColor><BackColor>Gainsboro</BackColor><BackgroundColor>Silver</BackgroundColor><CaptionForeColor>MidnightBlue</CaptionForeColor><CaptionBackColor>LightSteelBlue</CaptionBackColor><ForeColor>Black</ForeColor><GridLineColor>DimGray</GridLineColor><GridLineStyle>None</GridLineStyle><HeaderBackColor>MidnightBlue</HeaderBackColor><HeaderForeColor>White</HeaderForeColor><LinkColor>MidnightBlue</LinkColor><LinkHoverColor>RoyalBlue</LinkHoverColor><ParentRowsBackColor>DarkGray</ParentRowsBackColor><ParentRowsForeColor>Black</ParentRowsForeColor><SelectionForeColor>White</SelectionForeColor><SelectionBackColor>CadetBlue</SelectionBackColor></Scheme><Scheme><SchemeName>Professional 4</SchemeName><SchemePicture>professional4.bmp</SchemePicture><BorderStyle>None</BorderStyle><FlatMode>True</FlatMode><CaptionFont>Tahoma, 8pt, style=1</CaptionFont><HeaderFont>Tahoma, 8pt, style=1</HeaderFont><Font>Tahoma, 8pt</Font><AlternatingBackColor>Lavender</AlternatingBackColor><BackColor>WhiteSmoke</BackColor><BackgroundColor>LightGray</BackgroundColor><CaptionForeColor>MidnightBlue</CaptionForeColor><CaptionBackColor>LightSteelBlue</CaptionBackColor><ForeColor>MidnightBlue</ForeColor><GridLineColor>Gainsboro</GridLineColor><GridLineStyle>None</GridLineStyle><HeaderBackColor>MidnightBlue</HeaderBackColor><HeaderForeColor>WhiteSmoke</HeaderForeColor><LinkColor>Teal</LinkColor><LinkHoverColor>DarkMagenta</LinkHoverColor><ParentRowsBackColor>Gainsboro</ParentRowsBackColor><ParentRowsForeColor>MidnightBlue</ParentRowsForeColor><SelectionForeColor>WhiteSmoke</SelectionForeColor><SelectionBackColor>CadetBlue</SelectionBackColor></Scheme><Scheme><SchemeName>Classic</SchemeName><SchemePicture>classic.bmp</SchemePicture><BorderStyle>FixedSingle</BorderStyle><FlatMode>True</FlatMode><Font>Times New Roman, 9pt</Font><HeaderFont>Tahoma, 8pt, style=1</HeaderFont><CaptionFont>Tahoma, 8pt, style=1</CaptionFont><AlternatingBackColor>WhiteSmoke</AlternatingBackColor><BackColor>Gainsboro</BackColor><BackgroundColor>DarkGray</BackgroundColor><CaptionForeColor>Black</CaptionForeColor><CaptionBackColor>DarkKhaki</CaptionBackColor><ForeColor>Black</ForeColor><GridLineColor>Silver</GridLineColor><HeaderBackColor>Black</HeaderBackColor><HeaderForeColor>White</HeaderForeColor><LinkColor>DarkSlateBlue</LinkColor><LinkHoverColor>Firebrick</LinkHoverColor><ParentRowsForeColor>Black</ParentRowsForeColor><ParentRowsBackColor>LightGray</ParentRowsBackColor><SelectionForeColor>White</SelectionForeColor><SelectionBackColor>Firebrick</SelectionBackColor></Scheme><Scheme><SchemeName>Simple</SchemeName><SchemePicture>Simple.bmp</SchemePicture><BorderStyle>FixedSingle</BorderStyle><FlatMode>True</FlatMode><Font>Courier New, 9pt</Font><HeaderFont>Courier New, 10pt, style=1</HeaderFont><CaptionFont>Courier New, 10pt, style=1</CaptionFont><AlternatingBackColor>White</AlternatingBackColor><BackColor>White</BackColor><BackgroundColor>Gainsboro</BackgroundColor><CaptionForeColor>Black</CaptionForeColor><CaptionBackColor>Silver</CaptionBackColor><ForeColor>DarkSlateGray</ForeColor><GridLineColor>DarkGray</GridLineColor><HeaderBackColor>DarkGreen</HeaderBackColor><HeaderForeColor>White</HeaderForeColor><LinkColor>DarkGreen</LinkColor><LinkHoverColor>Blue</LinkHoverColor><ParentRowsForeColor>Black</ParentRowsForeColor><ParentRowsBackColor>Gainsboro</ParentRowsBackColor><SelectionForeColor>Black</SelectionForeColor><SelectionBackColor>DarkSeaGreen</SelectionBackColor></Scheme><Scheme><SchemeName>Colorful 1</SchemeName><SchemePicture>colorful1.bmp</SchemePicture><BorderStyle>FixedSingle</BorderStyle><FlatMode>True</FlatMode><Font>Tahoma, 8pt</Font><CaptionFont>Tahoma, 9pt, style=1</CaptionFont><HeaderFont>Tahoma, 9pt, style=1</HeaderFont><AlternatingBackColor>LightGoldenrodYellow</AlternatingBackColor><BackColor>White</BackColor><BackgroundColor>LightGoldenrodYellow</BackgroundColor><CaptionForeColor>DarkSlateBlue</CaptionForeColor><CaptionBackColor>LightGoldenrodYellow</CaptionBackColor><ForeColor>DarkSlateBlue</ForeColor><GridLineColor>Peru</GridLineColor><GridLineStyle>None</GridLineStyle><HeaderBackColor>Maroon</HeaderBackColor><HeaderForeColor>LightGoldenrodYellow</HeaderForeColor><LinkColor>Maroon</LinkColor><LinkHoverColor>SlateBlue</LinkHoverColor><ParentRowsBackColor>BurlyWood</ParentRowsBackColor><ParentRowsForeColor>DarkSlateBlue</ParentRowsForeColor><SelectionForeColor>GhostWhite</SelectionForeColor><SelectionBackColor>DarkSlateBlue</SelectionBackColor></Scheme><Scheme><SchemeName>Colorful 2</SchemeName><SchemePicture>colorful2.bmp</SchemePicture><BorderStyle>None</BorderStyle><FlatMode>True</FlatMode><Font>Tahoma, 8pt</Font><CaptionFont>Tahoma, 8pt, style=1</CaptionFont><HeaderFont>Tahoma, 8pt, style=1</HeaderFont><AlternatingBackColor>GhostWhite</AlternatingBackColor><BackColor>GhostWhite</BackColor><BackgroundColor>Lavender</BackgroundColor><CaptionForeColor>White</CaptionForeColor><CaptionBackColor>RoyalBlue</CaptionBackColor><ForeColor>MidnightBlue</ForeColor><GridLineColor>RoyalBlue</GridLineColor><HeaderBackColor>MidnightBlue</HeaderBackColor><HeaderForeColor>Lavender</HeaderForeColor><LinkColor>Teal</LinkColor><LinkHoverColor>DodgerBlue</LinkHoverColor><ParentRowsBackColor>Lavender</ParentRowsBackColor><ParentRowsForeColor>MidnightBlue</ParentRowsForeColor><SelectionForeColor>PaleGreen</SelectionForeColor><SelectionBackColor>Teal</SelectionBackColor></Scheme><Scheme><SchemeName>Colorful 3</SchemeName><SchemePicture>colorful3.bmp</SchemePicture><BorderStyle>None</BorderStyle><FlatMode>True</FlatMode><Font>Tahoma, 8pt</Font><CaptionFont>Tahoma, 8pt, style=1</CaptionFont><HeaderFont>Tahoma, 8pt, style=1</HeaderFont><AlternatingBackColor>OldLace</AlternatingBackColor><BackColor>OldLace</BackColor><BackgroundColor>Tan</BackgroundColor><CaptionForeColor>OldLace</CaptionForeColor><CaptionBackColor>SaddleBrown</CaptionBackColor><ForeColor>DarkSlateGray</ForeColor><GridLineColor>Tan</GridLineColor><GridLineStyle>Solid</GridLineStyle><HeaderBackColor>Wheat</HeaderBackColor><HeaderForeColor>SaddleBrown</HeaderForeColor><LinkColor>DarkSlateBlue</LinkColor><LinkHoverColor>Teal</LinkHoverColor><ParentRowsBackColor>OldLace</ParentRowsBackColor><ParentRowsForeColor>DarkSlateGray</ParentRowsForeColor><SelectionForeColor>White</SelectionForeColor><SelectionBackColor>SlateGray</SelectionBackColor></Scheme><Scheme><SchemeName>Colorful 4</SchemeName><SchemePicture>colorful4.bmp</SchemePicture><BorderStyle>FixedSingle</BorderStyle><FlatMode>True</FlatMode><Font>Tahoma, 8pt</Font><CaptionFont>Tahoma, 8pt, style=1</CaptionFont><HeaderFont>Tahoma, 8pt, style=1</HeaderFont><AlternatingBackColor>White</AlternatingBackColor><BackColor>White</BackColor><BackgroundColor>Ivory</BackgroundColor><CaptionForeColor>Lavender</CaptionForeColor><CaptionBackColor>DarkSlateBlue</CaptionBackColor><ForeColor>Black</ForeColor><GridLineColor>Wheat</GridLineColor><HeaderBackColor>CadetBlue</HeaderBackColor><HeaderForeColor>Black</HeaderForeColor><LinkColor>DarkSlateBlue</LinkColor><LinkHoverColor>LightSeaGreen</LinkHoverColor><ParentRowsBackColor>Ivory</ParentRowsBackColor><ParentRowsForeColor>Black</ParentRowsForeColor><SelectionForeColor>DarkSlateBlue</SelectionForeColor><SelectionBackColor>Wheat</SelectionBackColor></Scheme><Scheme><SchemeName>256 Color 1</SchemeName><SchemePicture>256_1.bmp</SchemePicture><Font>Tahoma, 8pt</Font><CaptionFont>Tahoma, 8 pt</CaptionFont><HeaderFont>Tahoma, 8pt</HeaderFont><AlternatingBackColor>Silver</AlternatingBackColor><BackColor>White</BackColor><CaptionForeColor>White</CaptionForeColor><CaptionBackColor>Maroon</CaptionBackColor><ForeColor>Black</ForeColor><GridLineColor>Silver</GridLineColor><HeaderBackColor>Silver</HeaderBackColor><HeaderForeColor>Black</HeaderForeColor><LinkColor>Maroon</LinkColor><LinkHoverColor>Red</LinkHoverColor><ParentRowsBackColor>Silver</ParentRowsBackColor><ParentRowsForeColor>Black</ParentRowsForeColor><SelectionForeColor>White</SelectionForeColor><SelectionBackColor>Maroon</SelectionBackColor></Scheme><Scheme><SchemeName>256 Color 2</SchemeName><SchemePicture>256_2.bmp</SchemePicture><BorderStyle>FixedSingle</BorderStyle><FlatMode>True</FlatMode><CaptionFont>Microsoft Sans Serif, 10 pt, style=1</CaptionFont><Font>Tahoma, 8pt</Font><HeaderFont>Tahoma, 8pt</HeaderFont><AlternatingBackColor>White</AlternatingBackColor><BackColor>White</BackColor><CaptionForeColor>White</CaptionForeColor><CaptionBackColor>Teal</CaptionBackColor><ForeColor>Black</ForeColor><GridLineColor>Silver</GridLineColor><HeaderBackColor>Black</HeaderBackColor><HeaderForeColor>White</HeaderForeColor><LinkColor>Purple</LinkColor><LinkHoverColor>Fuchsia</LinkHoverColor><ParentRowsBackColor>Gray</ParentRowsBackColor><ParentRowsForeColor>White</ParentRowsForeColor><SelectionForeColor>White</SelectionForeColor><SelectionBackColor>Maroon</SelectionBackColor></Scheme></pulica>"), XmlReadMode.IgnoreSchema);
this.schemeTable = this.dataSet.Tables["Scheme"];
this.IMBusy = true;
this.InitializeComponent();
this.schemeName.DataSource = this.schemeTable;
this.AddDataToDataGrid();
this.AddStyleSheetInformationToDataGrid();
if (dgrid.Site != null)
{
IUIService service = (IUIService) dgrid.Site.GetService(typeof(IUIService));
if (service != null)
{
Font font = (Font) service.Styles["DialogFont"];
if (font != null)
{
this.Font = font;
}
}
}
this.IMBusy = false;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:27,代码来源:DataGridAutoFormatDialog.cs
示例3: CreateResultControls
protected void CreateResultControls()
{
int resultTabIndex = 0;
Panel panel = AddResultPanel("result 1");
_gridResult1 = XtraGridControl.Create(dockStyle: DockStyle.Fill);
panel.Controls.Add(_gridResult1);
_grid1ResultTabIndex = resultTabIndex++;
panel = AddResultPanel("result 2");
_gridResult2 = DataGridViewControl.Create(dockStyle: DockStyle.Fill, showRowNumber: true);
panel.Controls.Add(_gridResult2);
_grid2ResultTabIndex = resultTabIndex++;
panel = AddResultPanel("result 3");
_gridResult3 = zForm.CreateDataGrid(dockStyle: DockStyle.Fill);
panel.Controls.Add(_gridResult3);
_grid3ResultTabIndex = resultTabIndex++;
_gridResultTabIndex = _grid2ResultTabIndex;
panel = AddResultPanel("result 4");
_treeResult = new TreeView();
_treeResult.Dock = DockStyle.Fill;
panel.Controls.Add(_treeResult);
_treeResultTabIndex = resultTabIndex++;
panel = AddResultPanel("message");
_logTextBox = LogTextBox.Create(dockStyle: DockStyle.Fill);
panel.Controls.Add(_logTextBox);
_messageResultTabIndex = resultTabIndex++;
}
开发者ID:labeuze,项目名称:source,代码行数:32,代码来源:RunSourceFormResult.cs
示例4: SharpQueryDataView
/// <summary>
/// Creates a new MyView object
/// </summary>
public SharpQueryDataView(ISchemaClass entity, int lines, SharpQuerySchemaClassCollection parameters)
{
if (entity == null)
{
throw new ArgumentNullException("entity");
}
TitleName = SharpQuery.SchemaClass.AbstractSharpQuerySchemaClass.RemoveBracket(entity.NormalizedName);
this.pDataGrid = new DataGrid();
this.pDataGrid.CaptionVisible = true;
this.pDataGrid.DataMember = "";
this.pDataGrid.Dock = System.Windows.Forms.DockStyle.Fill;
this.pDataGrid.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.pDataGrid.Location = new System.Drawing.Point(0, 0);
this.pDataGrid.Name = "dataGrid";
this.pDataGrid.Size = new System.Drawing.Size(292, 266);
this.pDataGrid.TabIndex = 0;
this.Schema = entity;
this.Datatable = this.Schema.Execute(lines, parameters);
// if ( this.Datatable == null )
// {
// WorkbenchSingleton.Workbench.ViewContentCollection.Remove( this );
// }
}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:28,代码来源:SharpQueryDataView.cs
示例5: InitializeComponent
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.dataGrid1 = new System.Windows.Forms.DataGrid();
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
this.SuspendLayout();
//
// dataGrid1
//
this.dataGrid1.Anchor = (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right);
this.dataGrid1.DataMember = "";
this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.dataGrid1.Location = new System.Drawing.Point(32, 24);
this.dataGrid1.Name = "dataGrid1";
this.dataGrid1.Size = new System.Drawing.Size(568, 192);
this.dataGrid1.TabIndex = 0;
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(640, 245);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.dataGrid1});
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
this.ResumeLayout(false);
}
开发者ID:hitswa,项目名称:winforms,代码行数:35,代码来源:gridbuttons.cs
示例6: AutoSizeColumn
/// <summary>
/// This can be used to auto-size the specified column in the specified
/// <see cref="System.Windows.Forms.DataGrid"/> control.
/// </summary>
/// <param name="dg">The data grid in which to size the column</param>
/// <param name="col">The column to resize</param>
internal static void AutoSizeColumn(DataGrid dg, int col)
{
MethodInfo mi = DataGridHelper.DataGridType(dg).GetMethod("ColAutoResize", BindingFlags.NonPublic |
BindingFlags.Instance);
mi.Invoke(dg, new object[] { col });
}
开发者ID:modulexcite,项目名称:ListControls,代码行数:13,代码来源:DataGridHelper.cs
示例7: DataGridCaption
internal DataGridCaption(DataGrid dataGrid) {
this.dataGrid = dataGrid;
this.downButtonVisible = dataGrid.ParentRowsVisible;
colorMap[0].OldColor = Color.White;
colorMap[0].NewColor = this.ForeColor;
OnGridFontChanged();
}
开发者ID:JianwenSun,项目名称:cc,代码行数:7,代码来源:DataGridCaption.cs
示例8: SetGridDataSource
public static void SetGridDataSource(DataGrid grid, object dataSource) {
grid.DataSource = dataSource;
DataGridTableStyle ts = new DataGridTableStyle((CurrencyManager) grid.BindingContext[dataSource]);
grid.TableStyles.Clear();
grid.TableStyles.Add(ts);
ts.GridColumnStyles.Clear();
}
开发者ID:BackupTheBerlios,项目名称:ch3etah-svn,代码行数:7,代码来源:DataGridHelper.cs
示例9: InitializeComponent
void InitializeComponent ()
{
dataGrid = new DataGrid ();
SuspendLayout ();
//
// dataGrid
//
dataGrid.DataMember = "";
dataGrid.HeaderForeColor = System.Drawing.SystemColors.ControlText;
dataGrid.Location = new System.Drawing.Point (10, 50);
dataGrid.Name = "dataGrid";
dataGrid.Size = new System.Drawing.Size (600, 500);
//
// MainForm
//
AutoScaleBaseSize = new System.Drawing.Size (5, 13);
ClientSize = new System.Drawing.Size (700, 600);
Controls.Add (dataGrid);
Text = "SWF-Datagrid RealSample";
Name = "MainForm";
Load += new System.EventHandler (MainFormLoad);
ResumeLayout (false);
}
开发者ID:hitswa,项目名称:winforms,代码行数:26,代码来源:swf-datagrid-realsample.cs
示例10: SetStyle
public static void SetStyle(DataGrid grid, Type rowObjectType)
{
if (grid == null || grid.DataSource == null)
return;
SetStyle(grid, grid.DataSource, DataGridDictionary.Instance.GetDataGridPropertys(rowObjectType.FullName), rowObjectType);
}
开发者ID:hkiaipc,项目名称:jsb,代码行数:7,代码来源:DataGridStyleHelper.cs
示例11: InitializeComponent
private void InitializeComponent()
{
this._previewGrid = new DataGrid();
this._previewButton = new MxButton();
this._previewGrid.BeginInit();
base.SuspendLayout();
this._previewGrid.AllowNavigation = false;
this._previewGrid.AllowSorting = false;
this._previewGrid.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
this._previewGrid.CaptionVisible = false;
this._previewGrid.DataMember = "";
this._previewGrid.HeaderForeColor = SystemColors.ControlText;
this._previewGrid.Location = new Point(8, 0x10);
this._previewGrid.Name = "_previewGrid";
this._previewGrid.ReadOnly = true;
this._previewGrid.Size = new Size(0x1dc, 0x120);
this._previewGrid.TabIndex = 0;
this._previewButton.Anchor = AnchorStyles.Right | AnchorStyles.Bottom;
this._previewButton.FlatStyle = FlatStyle.System;
this._previewButton.Location = new Point(0x198, 0x134);
this._previewButton.Name = "_previewButton";
this._previewButton.TabIndex = 1;
this._previewButton.Text = "Test Query";
this._previewButton.Click += new EventHandler(this.OnPreviewButtonClick);
base.Controls.AddRange(new Control[] { this._previewButton, this._previewGrid });
base.Caption = "Query Preview";
base.Description = "Test your query by entering some test data.";
base.Name = "QueryPreviewPanel";
base.Size = new Size(0x1ec, 340);
this._previewGrid.EndInit();
base.ResumeLayout(false);
}
开发者ID:ikvm,项目名称:webmatrix,代码行数:32,代码来源:QueryPreviewPanel.cs
示例12: GridTableStylesCollectionTests
public GridTableStylesCollectionTests ()
{
DataGrid grid = new DataGrid ();
GridTableStylesCollection sc = grid.TableStyles;
sc.CollectionChanged += new CollectionChangeEventHandler (OnCollectionChanged);
Console.WriteLine ("GridColumnStylesCollection default --- ");
DumpGridTableStylesCollection (sc);
Console.WriteLine ("Add single item");
DataGridTableStyle ts = new DataGridTableStyle ();
ts.MappingName = "Table1";
sc.Add (ts);
Console.WriteLine ("Add multipleitems");
sc.AddRange (new DataGridTableStyle [] {new DataGridTableStyle (), new DataGridTableStyle ()});
Console.WriteLine ("Remove At");
sc.RemoveAt (2);
Console.WriteLine ("Add single item");
ts = new DataGridTableStyle ();
ts.MappingName = "Table2";
sc.Add (ts);
for (int i = 0; i < sc.Count; i ++)
Console.WriteLine ("Element {0}:{1}", i, sc[i].MappingName);
sc.Remove (ts);
Console.WriteLine ("Contains Table1 {0}", sc.Contains ("Table1"));
Console.WriteLine ("Contains Table4 {0}", sc.Contains ("Table4"));
}
开发者ID:yaoshuyin,项目名称:csharp,代码行数:31,代码来源:GridTableStylesCollectionTests.cs
示例13: DataGridComboBoxColumn
/// <summary>
/// The only creator ;)
/// </summary>
/// <param name="colName">The name of the column</param>
/// <param name="dataSource">The datasource that contains the lookup table</param>
/// <param name="displayMember">The member of the lookuptable to display</param>
/// <param name="valueMember">The member of the lookuptable with the value</param>
/// <param name="dataGrid">The datagrid parent of this column</param>
public DataGridComboBoxColumn(string colName, DataTable dataSource, string displayMember, string valueMember, DataGrid dataGrid)
{
_comboBox = new ComboBox();
_comboBox.Visible = false;
_comboBox.DataSource = dataSource;
_dataTable = dataSource;
_comboBox.DisplayMember = displayMember;
_displayMember = displayMember;
_valueMember = valueMember;
_comboBox.ValueMember = valueMember;
_comboBox.DropDownStyle = ComboBoxStyle.DropDownList;
Graphics _graphicsContext = dataGrid.CreateGraphics();
float _widest = 0;
SizeF _stringSize = new SizeF(0, 0);
foreach (DataRow dr in dataSource.Rows)
{
_stringSize = _graphicsContext.MeasureString(dr[displayMember].ToString(), dataGrid.Font);
if (_stringSize.Width > _widest)
{
_widest = _stringSize.Width;
}
}
_comboBox.DropDownWidth = (int)Math.Ceiling(_widest);
this.Width = _comboBox.DropDownWidth + 25; // Add the space for the dropdown arrow
this.MappingName = colName;
this.HeaderText = colName;
dataGrid.Controls.Add(_comboBox);
}
开发者ID:hayrettinbebek,项目名称:e-cafe,代码行数:36,代码来源:CellStyles.cs
示例14: Run
public override void Run(ServiceController[] services, Form mainForm, DataGrid serviceGrid)
{
foreach ( ServiceController service in services )
{
if (!needsRunAs)
{
try
{
service.Start();
}
catch (Exception e)
{
needsRunAs = true;
}
}
if (needsRunAs)
{
this.ScriptHelper.RunProgram("net", "start " + service.ServiceName, null, true);
}
}
System.Threading.Thread.Sleep(500);
this.RefreshGridFromService( mainForm, serviceGrid );
}
开发者ID:kcsampson,项目名称:Kexplorer,代码行数:27,代码来源:StartServiceScript.cs
示例15: TestDefaultValues
public void TestDefaultValues ()
{
DataGrid dg = new DataGrid ();
Assert.AreEqual (true, dg.AllowNavigation, "AllowNavigation property");
Assert.AreEqual (true, dg.AllowSorting, "AllowSorting property");
Assert.AreEqual (BorderStyle.Fixed3D, dg.BorderStyle, "BorderStyle property");
Assert.AreEqual (string.Empty, dg.CaptionText, "CaptionText property");
Assert.AreEqual (true, dg.CaptionVisible, "CaptionVisible property");
Assert.AreEqual (true, dg.ColumnHeadersVisible, "ColumnHeadersVisible property");
Assert.AreEqual (new DataGridCell (), dg.CurrentCell, "CurrentCell property");
Assert.AreEqual (-1, dg.CurrentRowIndex, "CurrentRowIndex property");
Assert.AreEqual (string.Empty, dg.DataMember, "DataMember property");
Assert.AreEqual (null, dg.DataSource, "DataSource property");
Assert.AreEqual (0, dg.FirstVisibleColumn, "FirstVisibleColumn property");
Assert.AreEqual (false, dg.FlatMode, "FlatMode property");
Assert.AreEqual (DataGridLineStyle.Solid, dg.GridLineStyle, "GridLineStyle property");
Assert.AreEqual (DataGridParentRowsLabelStyle.Both, dg.ParentRowsLabelStyle, "ParentRowsLabelStyle property");
Assert.AreEqual (true, dg.ParentRowsVisible, "ParentRowsVisible property");
Assert.AreEqual (75, dg.PreferredColumnWidth, "PreferredColumnWidth property");
//Assert.AreEqual (16, dg.PreferredRowHeight, "PreferredRowHeight property");
Assert.AreEqual (false, dg.ReadOnly, "ReadOnly property");
Assert.AreEqual (true, dg.RowHeadersVisible, "RowHeadersVisible property");
Assert.AreEqual (35, dg.RowHeaderWidth, "RowHeaderWidth property");
Assert.AreEqual (null, dg.Site, "Site property");
Assert.AreEqual (string.Empty, dg.Text, "Text property");
Assert.AreEqual (0, dg.VisibleColumnCount, "VisibleColumnCount property");
// Font
Assert.IsFalse (dg.Font.Bold, "Font Bold");
Assert.IsTrue (dg.Font.IsSystemFont, "Font IsSystemFont");
Assert.IsFalse (dg.Font.Italic, "Font Italic");
Assert.IsFalse (dg.Font.Strikeout, "Font Strikeout");
Assert.IsFalse (dg.Font.Underline, "Font Underline");
}
开发者ID:Profit0004,项目名称:mono,代码行数:35,代码来源:DataGridTest.cs
示例16: Process
public void Process( DataGrid grid )
{
UiConfiguration.DisableControls();
try {
mProcessor.ProcessMessageList( Messages );
} catch (MessageListProcessorException e) {
MessageBox.Show(
"The application failed to process the message list using the " + mProcessor.GetType().Name + " processor.\n\n" + e.ToString(),
"Fail to process messages",
MessageBoxButtons.OK,
MessageBoxIcon.Error
);
} catch (UnauthorizedException) {
MessageBox.Show(
"DeskScop couldn't process your message list as the server refused your username or password.\n\nPlease ensure that they are correct!",
"Failed to read messages",
MessageBoxButtons.OK,
MessageBoxIcon.Exclamation
);
}
MessageListRenderer.RenderMessageList( Messages, grid );
if( Messages.Count > 0 )
UiConfiguration.EnableControls();
}
开发者ID:afit,项目名称:DeskScop,代码行数:27,代码来源:DeskScop.cs
示例17: InitializeComponent
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.dataGrid1 = new System.Windows.Forms.DataGrid();
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
this.SuspendLayout();
//
// dataGrid1
//
this.dataGrid1.DataMember = "";
this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.dataGrid1.Location = new System.Drawing.Point(16, 16);
this.dataGrid1.Name = "dataGrid1";
this.dataGrid1.Size = new System.Drawing.Size(496, 232);
this.dataGrid1.TabIndex = 0;
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(528, 262);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.dataGrid1});
this.Name = "Form1";
this.Text = "Read Data Set";
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
this.ResumeLayout(false);
}
开发者ID:ppatoria,项目名称:SoftwareDevelopment,代码行数:31,代码来源:READDS.CS
示例18: CreateGrid
/// <summary>
/// Creates a grid on the supplied tab page.
/// </summary>
private void CreateGrid(TabPage tab, DataTable datasource, string captiontext)
{
DataGrid grid = new DataGrid();
grid.CaptionText = captiontext;
grid.DataSource = datasource;
tab.Controls.Add(grid);
}
开发者ID:pontusm,项目名称:Deployer,代码行数:10,代码来源:DatabaseDetailsForm.cs
示例19: InitializeComponent
/// <summary>
/// �����֧������ķ��� - ��Ҫʹ�ô���༭����
/// �˷��������ݡ�
/// </summary>
private void InitializeComponent()
{
this.dataGrid1 = new System.Windows.Forms.DataGrid();
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
this.SuspendLayout();
//
// dataGrid1
//
this.dataGrid1.CaptionVisible = false;
this.dataGrid1.DataMember = "";
this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.dataGrid1.Location = new System.Drawing.Point(0, 0);
this.dataGrid1.Name = "dataGrid1";
this.dataGrid1.ReadOnly = true;
this.dataGrid1.Size = new System.Drawing.Size(552, 272);
this.dataGrid1.TabIndex = 0;
this.dataGrid1.DoubleClick += new System.EventHandler(this.dataGrid1_DoubleClick);
//
// SelectTable
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(552, 269);
this.Controls.Add(this.dataGrid1);
this.Name = "SelectTable";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "SelectTable";
this.TopMost = true;
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.SelectTable_FormClosing);
this.Load += new System.EventHandler(this.SelectTable_Load);
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
this.ResumeLayout(false);
}
开发者 |
请发表评论