哪个高手帮我转把VB转化成VB.net,谢谢,不过我没分了。。。我安的是VS2010,没办法自动转化。。。急啊
PublicSubGrid()'根据Rows和Cols加载行列数DimjAsIntegerWithMSFlexGrid1Forj=1To.Cols-1.TextMatri...
Public Sub Grid()'根据Rows和Cols加载行列数
Dim j As Integer
With MSFlexGrid1
For j = 1 To .Cols - 1
.TextMatrix(0, j) = "列" & j
Next j
For j = 1 To .Rows - 1
.TextMatrix(j, 0) = "行" & j
Next j
End With
End Sub
Private Sub Grid1_EnterCell()'对表格读功能的实现
If Grid1.Row = 0 Or Grid1.Col = 0 Then Exit Sub
With Text2
.Text = " "
.Visible = False
.Top = Grid1.Top + Grid1.CellTop
.Left = Grid1.Left + Grid1.CellLeft
.Width = Grid1.CellWidth
.Height = Grid1.CellHeight
.Text = Grid1.Text
.Visible = True
.SetFocus
End With
End Sub
Private Sub Grid1_LeaveCell()'对表格写功能的实现
Grid1.Text = Text2.Text
Text2.Text = " "
Text2.Visible = False
End Sub
Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)'用方向键控制光标在单元格的位置
Select Case KeyCode
Case 39 '向右
Grid1.SetFocus
If Grid1.Col < Grid1.Cols Then Text2.Left = Grid1.Left + Grid1.CellLeft
Case 37 '向左
Grid1.SetFocus
If Grid1.Col > 1 Then Text2.Left = Grid1.Left - Grid1.CellLeft
Case 40 '向下
Grid1.SetFocus
If Grid1.Row < Grid1.Rows Then Text2.Top = Grid1.Top + Grid1.CellTop
Case 38 '向上
Grid1.SetFocus
If Grid1.Row <= 2 Then
Text2.Top = Grid1.Top + Grid1.CellTop
Else
Text2.Top = Grid1.Top - Grid1.CellTop
End If
End Select
End Sub
Private Sub Text2_KeyUp(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case 37, 38, 39, 40
Text2.SetFocus
End Select
End Sub 展开
Dim j As Integer
With MSFlexGrid1
For j = 1 To .Cols - 1
.TextMatrix(0, j) = "列" & j
Next j
For j = 1 To .Rows - 1
.TextMatrix(j, 0) = "行" & j
Next j
End With
End Sub
Private Sub Grid1_EnterCell()'对表格读功能的实现
If Grid1.Row = 0 Or Grid1.Col = 0 Then Exit Sub
With Text2
.Text = " "
.Visible = False
.Top = Grid1.Top + Grid1.CellTop
.Left = Grid1.Left + Grid1.CellLeft
.Width = Grid1.CellWidth
.Height = Grid1.CellHeight
.Text = Grid1.Text
.Visible = True
.SetFocus
End With
End Sub
Private Sub Grid1_LeaveCell()'对表格写功能的实现
Grid1.Text = Text2.Text
Text2.Text = " "
Text2.Visible = False
End Sub
Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)'用方向键控制光标在单元格的位置
Select Case KeyCode
Case 39 '向右
Grid1.SetFocus
If Grid1.Col < Grid1.Cols Then Text2.Left = Grid1.Left + Grid1.CellLeft
Case 37 '向左
Grid1.SetFocus
If Grid1.Col > 1 Then Text2.Left = Grid1.Left - Grid1.CellLeft
Case 40 '向下
Grid1.SetFocus
If Grid1.Row < Grid1.Rows Then Text2.Top = Grid1.Top + Grid1.CellTop
Case 38 '向上
Grid1.SetFocus
If Grid1.Row <= 2 Then
Text2.Top = Grid1.Top + Grid1.CellTop
Else
Text2.Top = Grid1.Top - Grid1.CellTop
End If
End Select
End Sub
Private Sub Text2_KeyUp(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case 37, 38, 39, 40
Text2.SetFocus
End Select
End Sub 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询