MSHFLEXGRID学习笔记[3]

[入库:2006年2月23日] [更新:2007年3月24日]

本文简介:

CoDe = 1
     Do While CoDe < .Rows
     .TextMatrix(CoDe, 0) = "编号" & CoDe
     CoDe = CoDe + 1
     Loop
    End With
End Sub

Private Sub MSHFlexGrid1_click()
    Call YiDongTXT(MSHFlexGrid1, Txt, 15, 3)
   End Sub
Private Sub Txt_keypress(keyascii As Integer) \'添加完数据后,进行当前位置的判断
  If keyascii = vbKeyReturn Then
  Call JianYanTXT(MSHFlexGrid1, Txt)
  Call WanBiTXT(MSHFlexGrid1, Txt, 15, 3)
  End If
  If keyascii = vbKeyEscape Then
    Txt.Visible = False
    MSHFlexGrid1.SetFocus
    End If
End Sub
Private Function YiDongTXT(Table As MSHFlexGrid, _
                        kongJian As TextBox, _
                        RowNum As Integer, _
                        ColNum As Integer)
  If Table.Col <= ColNum And Table.Row <= RowNum Then
     kongJian.Left = Table.Left + Table.ColPos(Table.Col)
     kongJian.Top = Table.Top + _
         Table.RowPos(Table.Row)
     kongJian.Width = Table.ColWidth(Table.Col)
     kongJian.Height = Table.RowHeight(Table.Row)
     kongJian.Text = Table.Text
     kongJian.Visible = True
     kongJian.SetFocus
     End If
End Function
Private Function JianYanTXT(Table As MSHFlexGrid, _
                         kongJian As TextBox)
   Table.Text = kongJian.Text
                         End Function
    
       \'添加数据后,进近控件的移动 \'\'TXT
      
Private Function WanBiTXT(Table As MSHFlexGrid, _
                        kongJian As TextBox, _
                        RowNum As Integer, _
                        ColNum As Integer)
   If Table.Col = ColNum Then
        Table.Col = 0
       If Table.Row = RowNum Then
             Table.Row = 1
             Table.Col = 0
          Else
            Table.Row = Table.Row + 1
       End If
   End If
   If Table.Col < ColNum Then
        Table.Col = Table.Col + 1
   End If
        
     kongJian.Left = Table.Left + Table.ColPos(Table.Col)
     kongJian.Top = Table.Top + _
         Table.RowPos(Table.Row)
     kongJian.Width = Table.ColWidth(Table.Col)
     kongJian.Height = Table.RowHeight(Table.Row)
     kongJian.Text = Table.Text
     kongJian.Visible = True
     kongJian.SetFocus
 end function

 

本文关键:MSHFLEXGRID学习笔记
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top