當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。