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


C# DataGridView.UpdateRowHeightInfo方法代碼示例

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


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

示例1: ApplyDataGridViewPrefs

        void ApplyDataGridViewPrefs(DataGridView dataGridView, Preferences prefs)
        {
            if (dataGridView.Columns.Count > 1)
            {
                if (prefs.setLastColumnWidth)
                {
                    dataGridView.Columns[dataGridView.Columns.Count - 1].MinimumWidth = prefs.lastColumnWidth;
                }
                else
                {
                    // Workaround for a .NET bug which brings the DataGridView into an unstable state (causing lots of NullReferenceExceptions).
                    dataGridView.FirstDisplayedScrollingColumnIndex = 0;

                    dataGridView.Columns[dataGridView.Columns.Count - 1].MinimumWidth = 5;  // default
                }
            }
            if (dataGridView.RowCount > 0)
            {
                dataGridView.UpdateRowHeightInfo(0, true);
            }
            dataGridView.Invalidate();
            dataGridView.Refresh();
            AutoResizeColumns(dataGridView);
        }
開發者ID:gspatace,項目名稱:logexpert,代碼行數:24,代碼來源:LogWindow.cs

示例2: Bug2394_RowHeightLessThanMinHeightVirtMode

		[Test] // Xamarin bug #2394
		public void Bug2394_RowHeightLessThanMinHeightVirtMode ()
		{
			using (var dgv = new DataGridView ()) {
				dgv.VirtualMode = true;
				dgv.RowCount = 1;
				dgv.Rows [0].Height = 10;
				dgv.Rows [0].MinimumHeight = 5;
				dgv.RowHeightInfoNeeded += (sender, e) => {
					// Setting the height to a value less than the minimum height
					// will be silently ignored and instead set to MinimumHeight.
					e.Height = 2;
				};
				dgv.UpdateRowHeightInfo (0, false);
				Assert.AreEqual(5, dgv.Rows[0].Height);
				Assert.AreEqual(5, dgv.Rows[0].MinimumHeight);
			}
		}
開發者ID:Profit0004,項目名稱:mono,代碼行數:18,代碼來源:DataGridViewTest.cs

示例3: Bug2394_MinHeightGreaterThanOldRowHeightVirtMode

		[Test] // Xamarin bug #2394
		public void Bug2394_MinHeightGreaterThanOldRowHeightVirtMode ()
		{
			using (var dgv = new DataGridView ()) {
				dgv.VirtualMode = true;
				dgv.RowCount = 1;
				dgv.Rows [0].Height = 10;
				dgv.Rows [0].MinimumHeight = 5;
				dgv.RowHeightInfoNeeded += (sender, e) => {
					e.MinimumHeight = 30;
					e.Height = 40;
				};
				dgv.UpdateRowHeightInfo (0, false);
				Assert.AreEqual (40, dgv.Rows [0].Height);
				Assert.AreEqual (30, dgv.Rows [0].MinimumHeight);
			}
		}
開發者ID:Profit0004,項目名稱:mono,代碼行數:17,代碼來源:DataGridViewTest.cs

示例4: Bug2394_RowHeightLessThanOldMinHeightVirtMode

		[Test] // Xamarin bug #2394
		public void Bug2394_RowHeightLessThanOldMinHeightVirtMode ()
		{
			using (var dgv = new DataGridView ()) {
				dgv.VirtualMode = true;
				dgv.RowCount = 1;
				dgv.Rows [0].MinimumHeight = 5;
				dgv.Rows [0].Height = 10;
				dgv.RowHeightInfoNeeded += (sender, e) => {
					// NOTE: the order is important here.
					e.MinimumHeight = 2;
					e.Height = 2;
				};
				dgv.UpdateRowHeightInfo (0, false);
				Assert.AreEqual (2, dgv.Rows [0].Height);
				Assert.AreEqual (2, dgv.Rows [0].MinimumHeight);
			}
		}
開發者ID:Profit0004,項目名稱:mono,代碼行數:18,代碼來源:DataGridViewTest.cs


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