当前位置: 首页>>代码示例>>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;未经允许,请勿转载。