标题:MSFlexGrid+ Combo+Text 想在实现在MSFlexGrid里,敲了回车就进输入单元格进 ...
只看楼主
yiyaozjk
Rank: 2
等 级:论坛游民
帖 子:231
专家分:30
注 册:2010-3-10
结帖率:51.67%
 问题点数:0 回复次数:0 
MSFlexGrid+ Combo+Text 想在实现在MSFlexGrid里,敲了回车就进输入单元格进行编程,不行?
我的代码如下。请指点。。。。
Private Sub MSFlexGrid1_KeyDown(KeyCode As Integer, Shift As Integer)
  Select Case KeyCode
    Case 13
     If MSFlexGrid1.Col = 1 And MSFlexGrid1.Row <> 0 Then        ' Position and size the ListBox, then show it.
        If Combo3.Visible = True Then
           Combo3.Visible = False
           MSFlexGrid1.CellBackColor = &H80000005  'white
        End If
       Combo3.Width = MSFlexGrid1.CellWidth
      ' Combo2.Height = MSFlexGrid1.CellHeight
       Combo3.Left = MSFlexGrid1.CellLeft + MSFlexGrid1.Left
       Combo3.Top = MSFlexGrid1.CellTop + MSFlexGrid1.Top
       Combo3.Text = MSFlexGrid1.Text
       Combo3.Visible = True
    Else
       If MSFlexGrid1.Col <> 2 And MSFlexGrid1.Col <> 9 And MSFlexGrid1.Col <> 10 And MSFlexGrid1.Col <> 11 And MSFlexGrid1.Row <> 0 Then
        If Text2.Visible = True Then
           Text2.Visible = False
           MSFlexGrid1.CellBackColor = &H80000005  'white
        End If
      Text2.Left = MSFlexGrid1.CellLeft + MSFlexGrid1.Left
      Text2.Top = MSFlexGrid1.CellTop + MSFlexGrid1.Top
      Text2.Width = MSFlexGrid1.CellWidth
      Text2.Text = MSFlexGrid1.Text

      Text2.Height = MSFlexGrid1.CellHeight
      Text2.SelStart = 0
      Text2.SelLength = Len(Text2.Text)
      Text2.Visible = True
      Text2.SetFocus
    End If
   End If
    Case 46                 '<Del>, clear cell
        MSFlexGrid1.Tag = MSFlexGrid1   'assign to temp storage
        MSFlexGrid1 = ""
  End Select
End Sub
搜索更多相关主题的帖子: False white 
2014-03-30 21:19



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-429406-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.012964 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved