當前位置: 首頁>>代碼示例>>C#>>正文


C# DataGridView.SuspendDrawing方法代碼示例

本文整理匯總了C#中System.Windows.Forms.DataGridView.SuspendDrawing方法的典型用法代碼示例。如果您正苦於以下問題:C# DataGridView.SuspendDrawing方法的具體用法?C# DataGridView.SuspendDrawing怎麽用?C# DataGridView.SuspendDrawing使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Windows.Forms.DataGridView的用法示例。


在下文中一共展示了DataGridView.SuspendDrawing方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: setupPage

 private void setupPage()
 {
     // Back out if the page has already been SetUp
     if (currentDgv != null)
     {
         ((DataGridView)mainTabControl.SelectedTab.Controls[0]).SelectionMode = DataGridViewSelectionMode.RowHeaderSelect;
         return;
     }
     CtfEditorGamePage page;
     // Setup Page
     if (mainTabControl.SelectedIndex == (int)CtfEditorMainTabs.Formula1)
     {
         page = new CtfEditorGamePage(File.Open(System.Windows.Forms.Application.StartupPath + "\\ctfSchemaF12012.xml", FileMode.Open),
             CtfEditorMainTabs.Formula1);
     }
     else if (mainTabControl.SelectedIndex == (int)CtfEditorMainTabs.Dirt)
     {
         page = new CtfEditorGamePage(File.Open(System.Windows.Forms.Application.StartupPath + "\\ctfSchemaDirt.xml", FileMode.Open),
             CtfEditorMainTabs.Dirt);
     }
     else if (mainTabControl.SelectedIndex == (int)CtfEditorMainTabs.Other)
     {
         page = new CtfEditorGamePage(File.Open(System.Windows.Forms.Application.StartupPath + "\\ctfSchemaGrid2.xml", FileMode.Open),
             CtfEditorMainTabs.Other);
     }
     else if (mainTabControl.SelectedIndex == (int)CtfEditorMainTabs.Grid)
     {
         page = new CtfEditorGamePage(File.Open(System.Windows.Forms.Application.StartupPath + "\\ctfSchemaGrid.xml", FileMode.Open),
             CtfEditorMainTabs.Grid);
     }
     else
     {
         // SHOULD NOT HAPPEN, just doing it to satisfy compiler
         return;
     }
     // Setup DGV
     DataGridView dgv;
     dgv = new DataGridView();
     dgv.Dock = DockStyle.Fill;
     //dgv.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
     //dgv.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.DisplayedCells;
     dgv.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.AutoSizeToDisplayedHeaders;
     //dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
     dgv.DefaultCellStyle.WrapMode = DataGridViewTriState.True;
     dgv.AllowUserToAddRows = false;
     dgv.AllowUserToDeleteRows = false;
     dgv.AlternatingRowsDefaultCellStyle.BackColor = System.Drawing.ColorTranslator.FromHtml("#E8EDFF");
     dgv.TopLeftHeaderCell.Value = "ID";
     dgv.SelectionMode = DataGridViewSelectionMode.RowHeaderSelect;
     dgv.CellValueChanged += new DataGridViewCellEventHandler(dgv_CellValueChanged);
     dgv.CellBeginEdit += new DataGridViewCellCancelEventHandler(dgv_CellBeginEdit);
     dgv.ColumnHeaderMouseClick += new DataGridViewCellMouseEventHandler(dgv_ColumnHeaderMouseClick);
     dgv.CellMouseDown += new DataGridViewCellMouseEventHandler(dgv_CellMouseDown);
     dgv.DataError += new DataGridViewDataErrorEventHandler(dgv_DataError);
     dgv.CellEnter += new DataGridViewCellEventHandler(dgv_CellEnter);
     dgv.KeyDown += new KeyEventHandler(dgv_KeyDown);
     dgv.ColumnHeaderMouseDoubleClick += new DataGridViewCellMouseEventHandler(dgv_ColumnHeaderMouseDoubleClick);
     // Load Page Contents
     mainTabControl.SelectedTab.Tag = page;
     dgv.Columns.Add("entryName", "Entry Name");
     dgv.Columns[0].MinimumWidth = 150;
     dgv.Columns[0].ValueType = typeof(string);
     dgv.Columns[0].ReadOnly = true;
     dgv.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;
     DGVColumnFilterContextControl colFilter = new DGVColumnFilterContextControl(dgv, 0);
     dgv.SuspendDrawing();
     foreach (CtfEntryInfo entryInfo in page.ctfEntryInfo)
     {
         dgv.Rows.Add(entryInfo.name);
         dgv.Rows[entryInfo.id].HeaderCell.Value = Convert.ToString(entryInfo.id);
         //entryInfo.id == 0 || entryInfo.id == 1 || entryInfo.refID >= 0 ||
         if (entryInfo.readOnly)
         {
             dgv.Rows[entryInfo.id].ReadOnly = true;
         }
     }
     dgv.ResumeDrawing();
     mainTabControl.SelectedTab.Controls.Add(dgv);
     ActiveControl = currentDgv;
 }
開發者ID:BennyKJohnson,項目名稱:Ego-Engine-Modding,代碼行數:80,代碼來源:Form1.cs


注:本文中的System.Windows.Forms.DataGridView.SuspendDrawing方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。