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

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

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

// The DragSize indicates the size that the mouse can move

// before a drag event should be started.

Size dragSize = SystemInformation.DragSize;

// Create a rectangle using the DragSize, with the mouse position being

// at the center of the rectangle.

dragBoxFromMouseDown = new Rectangle(new Point(e.X - (dragSize.Width / 2),

e.Y - (dragSize.Height / 2)),

dragSize);

}

else

// Reset the rectangle if the mouse is not over an item in the ListBox.

dragBoxFromMouseDown = Rectangle.Empty;

}

private void dataGridView1_DragOver(object sender, DragEventArgs e)

{

e.Effect = DragDropEffects.Move;

}

private void dataGridView1_DragDrop(object sender, DragEventArgs e)

{

// The mouse locations are relative to the screen, so they must be

// converted to client coordinates.

Point clientPoint = dataGridView1.PointToClient(new Point(e.X, e.Y));

// Get the row index of the item the mouse is below.

rowIndexOfItemUnderMouseToDrop =

dataGridView1.HitTest(clientPoint.X, clientPoint.Y).RowIndex;

// If the drag operation was a move then remove and insert the row.

if (e.Effect== DragDropEffects.Move)

{

DataGridViewRow rowToMove = e.Data.GetData(

typeof(DataGridViewRow)) as DataGridViewRow;

dataGridView1.Rows.RemoveAt(rowIndexFromMouseDown);

dataGridView1.Rows.Insert(rowIndexOfItemUnderMouseToDrop, rowToMove);

}

}

14. 如何调整最后一列的宽度使其占据网的剩余客户区?

以默认方式填充DataGridView时,可能会发生因列的宽度不够,而暴露出控件的灰色背景的情况,很不美观。将最后一列的AutoSizeMode属性设置为Fill会使该列调整大小来填充网的剩余客户区(client area)。作为一个可选的方式,你可以设置最后一列MinimumWidth属性,以保持该列的宽度不至于太小。


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

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

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