本文整理匯總了C#中System.Windows.Forms.DataGridView.Except方法的典型用法代碼示例。如果您正苦於以下問題:C# DataGridView.Except方法的具體用法?C# DataGridView.Except怎麽用?C# DataGridView.Except使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Windows.Forms.DataGridView
的用法示例。
在下文中一共展示了DataGridView.Except方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: ReportFormShown
private void ReportFormShown(object sender, EventArgs e)
{
if (_first)
{
//formatting the datagrids width
var allGrids = new DataGridView[] { fullHeader, dataGridView1,
dataGridView2, dataGridView3, subHeader1, subHeader2, subHeader3 };
var lowerGrids = new DataGridView[] { dataGridView2, dataGridView3, subHeader2, subHeader3 };
var firstColumnWidth = dataGridView1.Columns[0].Width;
const int secondColumnWidth = Columnwidth;
foreach (var grid in allGrids.Except(lowerGrids))
grid.Columns[0].Width = firstColumnWidth + secondColumnWidth;
foreach (var grid in lowerGrids)
{
grid.Columns[0].Width = firstColumnWidth;
grid.Columns[1].Width = secondColumnWidth;
}
// divide width remaining into equally in 4 parts
var remainingColumnsWidth = (dataGridView1.Width - firstColumnWidth - secondColumnWidth) / 4;
for (var i = 2; i < 6; i++)
{
foreach (var grid in allGrids.Except(lowerGrids))
grid.Columns[i - 1].Width = remainingColumnsWidth;
foreach (var grid in lowerGrids)
grid.Columns[i].Width = remainingColumnsWidth;
}
foreach (var grid in allGrids)
{
//for numbers
for (var i = 1; i < grid.Columns.Count; i++)
grid.Columns[i].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
grid.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.None;
grid.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells;
grid.AutoSize = true;
}
fullHeader.AutoSize = false;
fullHeader.Height = fullHeader.Rows[0].Height;
//size up the comment
lblComment.Height = flowLayoutPanel2.Height -
flowLayoutPanel2.Controls.Cast<Control>()
.Where(p => p.Visible)
.Where(p => p != lblComment)
.Select(p => p.Height).Sum() - 10; //for buffer
}
var worker = new BackgroundWorker();
worker.DoWork +=
new DoWorkEventHandler(BwDoWork);
worker.RunWorkerCompleted +=
new RunWorkerCompletedEventHandler(BwRunWorkerCompleted);
//for second scrshot
if (_first)
{
this.ScrollControlIntoView(pictureBox1);
//this is used later to determine where the initial scroll started - use to position the second screen capture exactly.
_initScroll = this.VerticalScroll.Value;
}
else if (_second)
{
this.ScrollControlIntoView(dataGridView2);
}
else
{
this.ScrollControlIntoView(lblEndBlank);
}
//this has to work asynchronously, so that the UI does not freeze up and all the controls complete
// loading before the scrshot is taken
worker.RunWorkerAsync();
}