怎么能让DataGridView不可修改的列,不能获得焦点??
怎么能让DataGridView不可修改的列,不能获得焦点??我现在是把列属性设为只读,可是他还是可以获得焦点,就是当焦点移上去的时候会有一个虚线的框,我是想让焦点根本落不上
--------------------编程问答-------------------- Private Sub DataGridView_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles dgdBLNo.MouseUp
If IsNothing(DataGridView.DataSource) Then Exit Sub
If DataGridView.DataSource.Tables(0).Rows.Count <= 0 Then Exit Sub
DataGridView.Select(DataGridView.CurrentRowIndex)
End Sub --------------------编程问答-------------------- DataGridView.Select( 能带参数吗?? --------------------编程问答-------------------- DataGridView.tabstop=false --------------------编程问答-------------------- 是DataGridView的某个列 --------------------编程问答-------------------- 在CellEnter事件中写
if (dgvDatas.Columns[e.ColumnIndex].ReadOnly)
{
SendKeys.Send("{tab}");
} --------------------编程问答--------------------
该楼为正解 --------------------编程问答-------------------- DataGridView.tabstop=false
DataGridView.stanrdTab=false --------------------编程问答-------------------- .. --------------------编程问答-------------------- .. --------------------编程问答-------------------- 面临搂主一样的问题 --------------------编程问答-------------------- DataGridView.enabled = false --------------------编程问答-------------------- 关注啊 我也想知道
--------------------编程问答-------------------- DataGridView.tabstop=false
--------------------编程问答-------------------- 我也有这个问题 --------------------编程问答-------------------- 6楼的正确:
public Form1()
{
InitializeComponent();
this.Load+=new EventHandler(Form1_Load);
dataGridView1.CellEnter+=new DataGridViewCellEventHandler(dataGridView1_CellEnter);
}
void dataGridView1_CellEnter(object sender, DataGridViewCellEventArgs e)
{
if(dataGridView1.Columns[e.ColumnIndex].ReadOnly)
SendKeys.Send("{tab}");
}
void Form1_Load(object sender, EventArgs e)
{
dataGridView1.Columns.Add("sss","1");
dataGridView1.Columns.Add("ss2s","2");
dataGridView1.Rows.Add("s","s");
dataGridView1.Rows.Add("s", "s");
dataGridView1.Columns[0].ReadOnly = true;
}
补充:.NET技术 , VB.NET