今天图老师小编给大家介绍下怎样添加一个下拉框到msflexgrid,平时喜欢怎样添加一个下拉框到msflexgrid的朋友赶紧收藏起来吧!记得点赞哦~
【 tulaoshi.com - 编程语言 】
首先应该建立一个combo1的comboBox控件,作为下拉框的最终实现工具。
(本文来源于图老师网站,更多请访问http://www.tulaoshi.com/bianchengyuyan/)
Private Sub Combo1_Click()(本文来源于图老师网站,更多请访问http://www.tulaoshi.com/bianchengyuyan/)
MSFlexGrid1.Row = MSFlexGrid1.RowSel
MSFlexGrid1.Col = 2
MSFlexGrid1.Text = Combo1.Text
End Sub
'Private Sub Combo1_LostFocus()
'Combo1.Text = MSFlexGrid1.Text
'End Sub
Private Sub Form_Load()
Combo1.Visible = False
Combo1.AddItem "aaa"
Combo1.AddItem "bbb"
Combo1.AddItem "ccc"
MSFlexGrid1.Cols = 10
MSFlexGrid1.Rows = 10
End Sub
Private Sub MSFlexGrid1_EnterCell()
If MSFlexGrid1.Col = 2 Then
MSFlexGrid1.CellBackColor = vbWhite
MSFlexGrid1.CellForeColor = vbBlue
Combo1.Move MSFlexGrid1.Left + MSFlexGrid1.CellLeft, MSFlexGrid1.Top + MSFlexGrid1.CellTop, MSFlexGrid1.CellWidth
Combo1.Visible = True
'Combo1.Text = MSFlexGrid1.Text
Else
Exit Sub
End If
' Combo1.SelStart = 0
' Combo1.SelLength = Len(Combo1.Text)
End Sub
Private Sub MSFlexGrid1_LeaveCell()
'If MSFlexGrid1.Col = 2 Then
MSFlexGrid1.CellBackColor = vbWhite
MSFlexGrid1.CellForeColor = vbBlue
'Combo1.Move MSFlexGrid1.Left + MSFlexGrid1.CellLeft, MSFlexGrid1.Top + MSFlexGrid1.CellTop, MSFlexGrid1.CellWidth
'MSFlexGrid1.Text = Combo1.Text
' Else
'Exit Sub
'End If
End Sub
'Private Sub Combo1_Change()
'MSFlexGrid1.Row = MSFlexGrid1.RowSel
'MSFlexGrid1.Col = 2
'MSFlexGrid1.Text = Combo1.Text
'End Sub
Private Sub Timer1_Timer()
Timer1.Enabled = True
Combo1.Visible = False
End Sub
来源:http://www.tulaoshi.com/n/20160219/1614758.html
看过《怎样添加一个下拉框到msflexgrid》的人还看了以下文章 更多>>