本文整理匯總了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);
}
}