本文整理汇总了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);
}
示例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);
}
}
示例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);
}
}
示例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);
}
}