по хорошему - mLabel -надо класс сделать - чтоб нормально рисовался
создай форму и Textbox - назови Text1:)
вот код (у формы поставь KeyPreview = True, AutoRedraw = True)
Option Explicit
Private Type MyLabelType
Caption As String
Left As Single
Width As Single
Top As Single
Height As Single
End Type
Private mLabel() As MyLabelType
Private curIndex As Integer
Private Sub InitLabels()
Dim i As Integer
ReDim mLabel(1 To
For i = 1 To 8
mLabel(i).Caption = "Label" & i
mLabel(i).Left = 300
mLabel(i).Top = i * 600
mLabel(i).Width = 500 * i
mLabel(i).Height = 400
DrawLabel i
Next
curIndex = 8
Form_KeyPress Asc(vbTab)
End Sub
Private Sub DrawLabel(ByVal Index As Integer)
Me.CurrentX = mLabel(Index).Left
Me.CurrentY = mLabel(Index).Top
Me.Print mLabel(Index).Caption
Me.Line (mLabel(Index).Left, mLabel(Index).Top)-(mLabel(Index).Left + mLabel(Index).Width, mLabel(Index).Top + mLabel(Index).Height), , B
End Sub
Private Sub Form_Activate()
InitLabels
End Sub
Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = Asc(vbTab) Then
mLabel(curIndex).Caption = Text1.Text
curIndex = curIndex + 1
If curIndex = 9 Then curIndex = 1
Text1.Top = mLabel(curIndex).Top
Text1.Left = mLabel(curIndex).Left
Text1.Width = mLabel(curIndex).Width
Text1.Height = mLabel(curIndex).Height
Text1.Text = mLabel(curIndex).Caption
Text1.SelStart = 0
Text1.SelLength = Len(mLabel(curIndex).Caption)
End If
End Sub
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Text1.Top = mLabel(1).Top
Text1.Left = mLabel(1).Left
Text1.Width = mLabel(1).Width
Text1.Height = mLabel(1).Height
curIndex = 1
End Sub
я думаю идея ясна