本文整理汇总了C#中System.Windows.Forms.DataGrid.EndInit方法的典型用法代码示例。如果您正苦于以下问题:C# DataGrid.EndInit方法的具体用法?C# DataGrid.EndInit怎么用?C# DataGrid.EndInit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.DataGrid
的用法示例。
在下文中一共展示了DataGrid.EndInit方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DisplayTabularData
/// <summary>
/// Construct the window.
/// </summary>
/// <remarks>
/// This method constructs the window by creating both the data grid and the button.
/// </remarks>
public DisplayTabularData( )
{
this.AutoScaleBaseSize = new System.Drawing.Size (5, 13);
this.ClientSize = new System.Drawing.Size (464, 253);
this.Text = "01_DisplayTabularData" ;
this.dataGrid = new System.Windows.Forms.DataGrid ();
dataGrid.BeginInit ();
dataGrid.Location = new System.Drawing.Point (8, 8);
dataGrid.Size = new System.Drawing.Size (448, 208);
dataGrid.TabIndex = 0;
dataGrid.Anchor = AnchorStyles.Bottom | AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right ;
this.Controls.Add (this.dataGrid);
dataGrid.EndInit ();
this.retrieveButton = new System.Windows.Forms.Button ();
retrieveButton.Location = new System.Drawing.Point (384, 224);
retrieveButton.Size = new System.Drawing.Size (75, 23);
retrieveButton.TabIndex = 1;
retrieveButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Right ;
retrieveButton.Text = "Retrieve";
retrieveButton.Click += new System.EventHandler (this.retrieveButton_Click);
this.Controls.Add (this.retrieveButton);
}
示例2: InitializeComponent
private void InitializeComponent()
{
label1 = new Label();
Cancel = new Button();
OK = new Button();
LoadXml = new Button();
dataGrid1 = new DataGrid();
panelTopMain = new Panel();
panelBottomMain = new Panel();
panelTopMain.SuspendLayout();
panelBottomMain.SuspendLayout();
base.SuspendLayout();
label1.Font = new Font("Microsoft Sans Serif", 12f, FontStyle.Bold, GraphicsUnit.Point, 0);
label1.Location = new Point(0x10, 8);
label1.Name = "label1";
label1.Size = new Size(200, 0x18);
label1.TabIndex = 3;
label1.Text = "Data Set";
Cancel.Location = new Point(0xe0, 8);
Cancel.FlatStyle = FlatStyle.Popup;
Cancel.Name = "Cancel";
Cancel.Size = new Size(0x60, 0x18);
Cancel.TabIndex = 1;
Cancel.Text = "Cancel";
Cancel.Click += new EventHandler(Cancel_Click);
OK.Location = new Point(0x148, 8);
OK.FlatStyle = FlatStyle.Popup;
OK.Name = "OK";
OK.Size = new Size(0x60, 0x18);
OK.TabIndex = 1;
OK.Text = "OK";
OK.Click += new EventHandler(OK_Click);
LoadXml.Location = new Point(0x1b0, 8);
LoadXml.FlatStyle = FlatStyle.Popup;
LoadXml.Name = "LoadXml";
LoadXml.Size = new Size(0x60, 0x18);
LoadXml.TabIndex = 1;
LoadXml.Text = "Load XML...";
LoadXml.Click += new EventHandler(LoadXml_Click);
dataGrid1.CaptionVisible = true;
dataGrid1.DataMember = "";
dataGrid1.Name = "dataGrid1";
dataGrid1.Dock = DockStyle.Fill;
dataGrid1.TabIndex = 4;
dataGrid1.Navigate += new NavigateEventHandler(dataGrid1_Navigate);
panelTopMain.BorderStyle = BorderStyle.None;
panelTopMain.Controls.AddRange(new Control[] {label1, Cancel, OK, LoadXml});
panelTopMain.Dock = DockStyle.Top;
panelTopMain.Name = "panelTopMain";
panelTopMain.Size = new Size(0, 50);
panelTopMain.TabIndex = 0;
panelBottomMain.BorderStyle = BorderStyle.None;
panelBottomMain.Controls.AddRange(new Control[] {dataGrid1});
panelBottomMain.Dock = DockStyle.Fill;
panelBottomMain.Location = new Point(0, 50);
panelBottomMain.Name = "panelBottomMain";
panelBottomMain.TabIndex = 1;
panelBottomMain.SizeChanged += new EventHandler(PanelBottomMain_SizeChanged);
base.AcceptButton = OK;
base.CancelButton = Cancel;
AutoScaleBaseSize = new Size(5, 13);
base.ClientSize = new Size(0x2c0, 0x14d);
base.Controls.AddRange(new Control[] {panelBottomMain, panelTopMain});
base.Name = "EditForm";
Text = "Form1";
base.FormBorderStyle = FormBorderStyle.Fixed3D;
base.Load += new EventHandler(EditForm_Load);
dataGrid1.EndInit();
base.ResumeLayout(false);
}
示例3: DataGridResize
private void DataGridResize(ref DataGrid grd, int iColumnCount)
{
grd.BeginInit();
foreach(DataGridTableStyle grdStyle in grd.TableStyles)
{
try
{
int width = grd.Width - 56;//53;//real is 56
GridColumnStylesCollection cols = grdStyle.GridColumnStyles;
int oldwidth = 0;
for(byte i =0;i <iColumnCount;i++)
{
oldwidth = oldwidth +cols[i].Width;// col.Width;
}
if(oldwidth == 0)
return;
int count = grdStyle.GridColumnStyles.Count;
double scale = 1.0*width/oldwidth;
foreach(DataGridColumnStyle col in cols)
{
col.Width = (int)(col.Width * scale);
}
}
catch(Exception ex)
{
log.Error(ex.Message,ex);
}
}
grd.EndInit();
}
示例4: DataSourceDataView
/// <summary>
/// Construct the window.
/// </summary>
/// <remarks>
/// This method constructs the window by creating both the data grid and the button.
/// </remarks>
public DataSourceDataView( )
{
/* this.AutoScaleBaseSize = new System.Drawing.Size (5, 13);
this.ClientSize = new System.Drawing.Size (464, 253);
this.Text = "04_DataSourceDataView" ;
this.dataGrid = new System.Windows.Forms.DataGrid ();
dataGrid.BeginInit ();
dataGrid.Location = new System.Drawing.Point (8, 8);
dataGrid.Size = new System.Drawing.Size (448, 208);
dataGrid.TabIndex = 0;
dataGrid.Anchor = AnchorStyles.Bottom | AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right ;
this.Controls.Add (this.dataGrid);
dataGrid.EndInit ();
this.retrieveButton = new System.Windows.Forms.Button ();
retrieveButton.Location = new System.Drawing.Point (384, 224);
retrieveButton.Size = new System.Drawing.Size (75, 23);
retrieveButton.TabIndex = 1;
retrieveButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Right ;
retrieveButton.Text = "Retrieve";
retrieveButton.Click += new System.EventHandler (this.retrieveButton_Click);
this.Controls.Add (this.retrieveButton); */
this.AutoScaleBaseSize = new System.Drawing.Size (5, 13);
this.ClientSize = new System.Drawing.Size (464, 493);
this.Text = "04_DataSourceDataView" ;
this.dataGrid = new System.Windows.Forms.DataGrid ();
dataGrid.BeginInit ();
dataGrid.CaptionText = "From Database";
dataGrid.Font = new System.Drawing.Font ("Tahoma", 8);
dataGrid.Location = new System.Drawing.Point (8, 8);
dataGrid.Size = new System.Drawing.Size (448, 208);
dataGrid.TabIndex = 0;
dataGrid.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right ;
this.Controls.Add (this.dataGrid);
dataGrid.EndInit ();
this.retrieveButton = new System.Windows.Forms.Button ();
retrieveButton.Location = new System.Drawing.Point (8, 224);
retrieveButton.Size = new System.Drawing.Size (75, 23);
retrieveButton.TabIndex = 1;
retrieveButton.Anchor = AnchorStyles.Top | AnchorStyles.Left ;
retrieveButton.Text = "Retrieve";
retrieveButton.Click += new System.EventHandler (this.retrieveButton_Click);
this.Controls.Add (this.retrieveButton);
this.comboBox1 = new System.Windows.Forms.ComboBox ();
comboBox1.Location = new System.Drawing.Point (96, 224);
comboBox1.Size = new System.Drawing.Size (360, 21);
comboBox1.DropDownStyle = ComboBoxStyle.DropDownList;
comboBox1.TabIndex = 2;
comboBox1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right ;
comboBox1.SelectedIndexChanged += new System.EventHandler (this.comboBox1_SelectedIndexChanged);
comboBox1.Items.AddRange ( new object[8] { "Added" , "CurrentRows", "Deleted", "ModifiedCurrent", "ModifiedOriginal", "None", "OriginalRows", "Unchanged"} ) ;
this.Controls.Add (this.comboBox1);
this.dataGrid2 = new System.Windows.Forms.DataGrid ();
dataGrid2.BeginInit ();
dataGrid2.Location = new System.Drawing.Point (8, 256);
dataGrid2.Size = new System.Drawing.Size (448, 232);
dataGrid2.DataMember = "";
dataGrid2.CaptionText = "Filtered";
dataGrid2.Font = new System.Drawing.Font ("Tahoma", 8);
dataGrid2.TabIndex = 3;
dataGrid2.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right ;
this.Controls.Add (this.dataGrid2);
dataGrid2.EndInit();
}