VB怎么实现MSHFlexGrid可以手动输入数据
要设定其中某两个框可以手动输入数据,该怎么写?最右边的两个、要怎么和textbox结合?textbox的位置怎么确定?如果textbox覆盖了原来的数据怎么办?...
要设定其中某两个框可以手动输入数据,该怎么写?最右边的两个、要怎么和textbox结合?textbox的位置怎么确定?如果textbox覆盖了原来的数据怎么办?
展开
1个回答
2013-10-12
展开全部
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Private Sub Form_Load() HG.Rows = 3
HG.Cols = 3
HG.ColWidth(0) = 0
HG.RowHeight(0) = 0
HG.ColWidth(2) = 1000
End SubPrivate Sub HG_Click() InText.Width = 985
InText.Height = 450 InText.Visible = True
'如果原来单元格有内容的,把内容复制到文本框,如果原来是空白的,把空白符复给文本框,相当于清除了文本框内容
InText.Text = HG.TextMatrix(HG.Row, HG.Col)
'使光标到最后
InText.SelStart = Len(InText.Text)
InText.SelLength = Len(InText.Text) + 1
InText.SetFocus
End SubPrivate Sub InText_KeyUp(KeyCode As Integer, Shift As Integer)
HG.TextMatrix(HG.Row, HG.Col) = InText.Text
If KeyCode = 13 Then
InText.Text = ""
InText.Visible = False
End If
End Sub
Private Sub Form_Load() HG.Rows = 3
HG.Cols = 3
HG.ColWidth(0) = 0
HG.RowHeight(0) = 0
HG.ColWidth(2) = 1000
End SubPrivate Sub HG_Click() InText.Width = 985
InText.Height = 450 InText.Visible = True
'如果原来单元格有内容的,把内容复制到文本框,如果原来是空白的,把空白符复给文本框,相当于清除了文本框内容
InText.Text = HG.TextMatrix(HG.Row, HG.Col)
'使光标到最后
InText.SelStart = Len(InText.Text)
InText.SelLength = Len(InText.Text) + 1
InText.SetFocus
End SubPrivate Sub InText_KeyUp(KeyCode As Integer, Shift As Integer)
HG.TextMatrix(HG.Row, HG.Col) = InText.Text
If KeyCode = 13 Then
InText.Text = ""
InText.Visible = False
End If
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询