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