| 网站首页 | JAVA文章 | AppServers | Web开发 | 应用开发 | 资源下载 | 论坛
    想学好编程,学好外语很重要  [enadd  2006年12月25日]        
设为首页 加入收藏 联系站长
您现在的位置: 编程笔记网 >> 应用开发 >> vb >> 控件 >> 文章正文
加强型的 MSFlexGrid            【字体:
加强型的 MSFlexGrid
作者:-    文章来源:-    点击数:    更新时间:2006-6-10

   If .ColSel = .Col And .RowSel = .Row Then
   '表示没有多个栏位的选取,这时才真正是可以输入
     Call toEditGrid(.Col, .Row)
   End If
End If
     End If
End With
End Sub
Private Sub MSFlexGrid1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn And Not Text1.Visible Then
   With MSFlexGrid1
Call toEditGrid(.Col, .Row)
   End With
End If
End Sub
'TextBox上的输入反映到MsFlexGrid上
Private Sub Text1_Change()
MSFlexGrid1.Text = Text1.Text
End Sub
'按下Down/Up 时结束TextBox的Keyin
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyUp Then
   Text1.Visible = False
   MSFlexGrid1.SetFocus
   SendKeys "{up}"
Else
  If KeyCode = vbKeyDown Then
     Text1.Visible = False
     MSFlexGrid1.SetFocus
     SendKeys "{down}"
  End If
End If
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then
   KeyAscii = 0
   Text1.Visible = False
   MSFlexGrid1.SetFocus
End If
If KeyAscii = vbKeyEscape Then
   KeyAscii = 0
   MSFlexGrid1.Text = OldText
   Text1.Visible = False
   MSFlexGrid1.SetFocus
End If
End Sub

Private Sub Text1_LostFocus()
Text1.Visible = False
End Sub
'设定TextBox於MSFlexGrid1的Current Cell上
Private Sub toEditGrid(ByVal C As Integer, ByVal R As Integer)
With MSFlexGrid1
   .Col = C: .Row = R
   Text1.Left = .Left + .ColPos(C)
   Text1.Top = .Top + .RowPos(R)
   If .Appearance = flex3D Then
      Text1.Left = Text1.Left + 2 * Screen.TwipsPerPixelX
      Text1.Top = Text1.Top + 2 * Screen.TwipsPerPixelY
   End If
   Text1.Width = .ColWidth(C)
   Text1.Height = .RowHeight(R)
   Text1.Text = .Text
   OldText = .Text
End With
Text1.Visible = True
Text1.SelStart = Len(Text1.Text)
Text1.SetFocus
End Sub
'以下程式处理Multi-column Selection的问题
Private Sub ProcMultiColSel(ByVal Shift As Integer)
Dim i As Long, HaveSel As Boolean
Dim SelSt As Long, SelEnd As Long
Dim OldRowSel As Long, OldColSel As Long
With MSFlexGrid1
OldRowSel = .RowSel: OldColSel = .ColSe

上一页  [1] [2] [3] 下一页  

文章录入:enadd    责任编辑:enadd 
  • 上一篇文章:

  • 下一篇文章:
  • 发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
    最新热点 最新推荐 相关文章
  • 用VB编写DirectX7.0游戏(下…

  • 用VB编写DirectX7.0游戏(上…

  • 使用OLE DB和ADO调用返回记录…

  • 使用VB调用Oracle程序包内的…

  • VB中用ADO对象动态创建数据库…

  • fffff

  • 如何用MSComm Control传Bina…

  • MultiLink的WinSock Server程…

  • 用VB制作浏览器

  • 用VB编写网络寻呼机

  •   网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
    | 设为首页 | 加入收藏 | 联系站长 | 友情链接 | 版权申明 | 管理登录 |