Windows Forms Datagridview(用鼠标指针选择单元格中的部分文本,但不允许编辑)VB.NET [英] Windows Forms Datagridview (Select part of text in cell with mousepointer but dont allow edit) VB.NET
本文介绍了Windows Forms Datagridview(用鼠标指针选择单元格中的部分文本,但不允许编辑)VB.NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
因此,我正在寻找一种解决方案,能够选择数据网格视图的单元格中的文本的一部分,但不允许用户编辑其中的值。
Advantage中的Tanx
推荐答案
dataGridView1.ReadOnly = false and dataGridView1.enabled = true
Private Sub dataGridView1_EditingControlShowing(sender As Object, e As DataGridViewEditingControlShowingEventArgs)
If TypeOf e.Control Is TextBox Then
' Set the TextBoxCell to readonly
Dim textBoxCell As TextBox = DirectCast(e.Control, TextBox)
textBoxCell.[ReadOnly] = True
End If
End Sub
这篇关于Windows Forms Datagridview(用鼠标指针选择单元格中的部分文本,但不允许编辑)VB.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文