当前位置: 首页>>代码示例>>C#>>正文


C# DataGrid.BeginInit方法代码示例

本文整理汇总了C#中System.Windows.Forms.DataGrid.BeginInit方法的典型用法代码示例。如果您正苦于以下问题:C# DataGrid.BeginInit方法的具体用法?C# DataGrid.BeginInit怎么用?C# DataGrid.BeginInit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.DataGrid的用法示例。


在下文中一共展示了DataGrid.BeginInit方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
 }
开发者ID:alannet,项目名称:example,代码行数:28,代码来源:DisplayTabularData.cs

示例2: 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();
 }
开发者ID:hieu292,项目名称:project-dms,代码行数:30,代码来源:frmHistoryTracking.cs

示例3: 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();
    }
开发者ID:alannet,项目名称:example,代码行数:73,代码来源:DataSourceDataView.cs


注:本文中的System.Windows.Forms.DataGrid.BeginInit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。