b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

datagridview重叠_datagridview绑定list_datagridview右键菜单(58)

电脑杂谈  发布时间:2017-05-30 08:07:57  来源:网络整理

dgcb.DataSource = territoriesBindingSource; //unfiltered

this.filteredTerritoriesBS.RemoveFilter();

}

}

下面的示例演示了如何在CellValidating事件中填充(padding)一个单元为错误图标提供空间。因为默认情况下填充行为会影响错误图标的位置,该示例(TODO)。The below sample demonstrates how you can set a cell’s padding in the CellValidating event to provide spacing for the error icon. Since padding by default affects the location of the error icon the sample uses the CellPainting to move the position of the icon for painting. Lastly, the sample uses the tooltip control to display a custom tooltip when the mouse is over the cell to indicate what the problem is. This sample could also be written as a custom cell that overrides GetErrorIconBounds method to provide a location for the error icon that was independent of the padding.

private ToolTip errorTooltip;

private Point cellInError = new Point(-2, -2);

public Form1()

{

InitializeComponent();

dataGridView1.ColumnCount = 3;

dataGridView1.RowCount = 10;

}

private void dataGridView1_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)

{

if (dataGridView1.IsCurrentCellDirty)

{

if (e.FormattedValue.ToString() == "BAD")

{

DataGridViewCell cell = dataGridView1[e.ColumnIndex, e.RowIndex];

cell.ErrorText = "Invalid data entered in cell";

// increase padding for icon. This moves the editing control

if (cell.Tag == null)

{

cell.Tag = cell.Style.Padding;

cell.Style.Padding = new Padding(0, 0, 18, 0);

cellInError = new Point(e.ColumnIndex, e.RowIndex);

}


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/tongxinshuyu/article-50070-58.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    热点图片
    拼命载入中...