早教吧 育儿知识 作业答案 考试题库 百科 知识分享

请教:下面程序中的ifcon=1thend3=0endif是什么意思?OptionExplicitDimcon,draw,a,topx,leftx,d3,bPrivateSubFormKeyDown(KeyCodeAsInteger,ShiftAsInteger)Ifd3=0ThenGoToskipEndIfIfKeyCode=vbKeyPThenb=0

题目详情
请教:下面程序中的if con=1 then d3=0 end if是什么意思?
Option Explicit
Dim con, draw, a, topx, leftx, d3, b
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If d3 = 0 Then
GoTo skip
End If
If KeyCode = vbKeyP Then
b = 0
Printer.Orientation = vbPRORLandscape
back:
b = b + 1
Printer.Line (lneDraw(b).X1, lneDraw(b).Y1)-(lneDraw(b).X2, lneDraw(b).Y2)
If lne3D1(1).Visible = True Then
Printer.Line (lne3D1(b).X1, lne3D1(b).Y1)-(lne3D1(b).X2, lne3D1(b).Y2), &H808080
Printer.Line (lne3D2(b).X1, lne3D2(b).Y1)-(lne3D2(b).X2, lne3D2(b).Y2), &H808080
End If
If Not b = draw Then
GoTo back
End If
Printer.EndDoc
End If
If KeyCode = vbKeyUp Then
topx = topx - 15
ElseIf KeyCode = vbKeyDown Then
topx = topx + 15
ElseIf KeyCode = vbKeyLeft Then
leftx = leftx - 15
ElseIf KeyCode = vbKeyRight Then
leftx = leftx + 15
End If
For a = 1 To draw
lne3D1(a).Visible = True
lne3D1(a).X1 = shpConnector(a).Left + leftx + 60
lne3D1(a).Y1 = shpConnector(a).Top + topx + 60
lne3D1(a).X2 = shpConnector(a + 1).Left + leftx + 60
lne3D1(a).Y2 = shpConnector(a + 1).Top + topx + 60

lne3D2(a).Visible = True
lne3D2(a).X1 = shpConnector(a).Left + 60
lne3D2(a).Y1 = shpConnector(a).Top + 60
lne3D2(a).X2 = lne3D1(a).X1
lne3D2(a).Y2 = lne3D1(a).Y1
Next a
lne3D2(draw + 1).Visible = True
lne3D2(draw + 1).X1 = shpConnector(con).Left + 60
lne3D2(draw + 1).Y1 = shpConnector(con).Top + 60
lne3D2(draw + 1).X2 = lne3D1(draw).X2
lne3D2(draw + 1).Y2 = lne3D1(draw).Y2
skip:
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then
If con > 0 Then
shpConnector(con).Visible = False
lne3D2(con).Visible = False
con = con - 1
End If

If con = 1 Then
d3 = 0
End If

If con = 0 Then
leftx = 0
topx = 0
End If

If draw > 0 Then
lneDraw(draw).Visible = False
lne3D1(draw).Visible = False
draw = draw - 1
End If
Else
If con = 199 Then
GoTo skip2
End If

con = con + 1
shpConnector(con).Visible = True
shpConnector(con).Left = X - 60
shpConnector(con).Top = Y - 60
If con > 1 Then
d3 = 1
draw = draw + 1
lneDraw(draw).Visible = True
lneDraw(draw).X1 = shpConnector(con - 1).Left + 60
lneDraw(draw).Y1 = shpConnector(con - 1).Top + 60
lneDraw(draw).X2 = shpConnector(con).Left + 60
lneDraw(draw).Y2 = shpConnector(con).Top + 60
End If
End If
skip2:
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Form1.Caption = "三维制图 [X: " & X & " Y: " & Y & "]"
End Sub
▼优质解答
答案和解析
选择ExplicitDim案子,画,leftx topx,d3,bPrivate子Form_KeyDown(转换为整数,转变为整数)如果d3 = 0然后GoTo skipEnd IfIf键码= vbKeyP然后b = 0打印机.定向= vbPRORLandscapeback:b = b + 1打印机.线(lneDraw(b).X1,y1 lneDraw(b))-(lneDraw(b).X2,y2)lneDraw(b)如果lne3D1(1).可见= True那么打印机.线(lne3D1(b).X1,y1 lne3D1(b))-(lne3D1(b).X2,y2)lne3D1(b),&H808080打印机.线(lne3D2(b).X1,y1 lne3D2(b))-(lne3D2(b).X2,y2)lne3D2(b),&H808080结束如果如果不是b =画然后转到后端如果打印机.EndDocEnd IfIf键码= vbKeyUp然后topx = topx - 15 elseif键码= vbKeyDown然后topx = topx + 15 elseif键码= vbKeyLeft然后leftx = leftx - 15 elseif键码= vbKeyRight然后leftx = leftx + 15 IfFor结束一个= 1来吸引lne3D1(一个).可见lne3D1 = True().X1 = shpConnector(一个).左+ leftx + 60 lne3D1(一个).Y1 = shpConnector(a).顶级+ topx + 60 lne3D1(一个).X2 = shpConnector(+ 1)左+ leftx + 60 lne3D1(一个).Y2 = shpConnector(+ 1)最高+ topx + 60 lne3D2(一个).可见lne3D2 = True().X1 = shpConnector(一个).左+ 60 lne3D2(一个).Y1 = shpConnector(a).顶级+ 60 lne3D2(一个).X2 = lne3D1(一个).X1 lne3D2(一个).Y2 = lne3D1(一个).Y1Next alne3D2(画+ 1)可见= Truelne3D2(画+ 1)x1 = shpConnector(反对).左+ 60 lne3d2(画+ 1)y1 = shpConnector(体质).顶级+ 60 lne3d2(画+ 1)x2 = lne3D1(吸引).X2lne3D2(画+ 1)y2 = lne3D1(吸引).Y2skip:结束SubPrivate子Form_MouseDown(按钮作为整数,转变为整数,X,Y是作为一个单独的单)如果按钮= 2然后如果反对> 0然后shpConnector(反对).可见= False lne3D2(反对).可见= False con = con - 1结束如果如果反对= 1然后d3 = 0结束如果如果反对= 0然后leftx = 0 topx = 0结束如果如果画> 0然后lneDraw(吸引).可见= False lne3D1(吸引).可见= False画=画- 1结束IfElse如果反对= 199然后GoTo skip2结束如果反对=体质+ 1 shpConnector(反对).可见shpConnector = True(反对).左= X - 60 shpConnector(反对).顶级= Y - 60如果反对> 1然后d3 = 1平局=画+ 1 lneDraw(吸引).可见lneDraw = True(吸引).X1 = shpConnector(con - 1)左+ 60 lneDraw(吸引).Y1 = shpConnector(con - 1)最高+ 60 lneDraw(吸引).X2 = shpConnector(反对).左+ 60 lneDraw(吸引).Y2 = shpConnector(反对).顶级+ 60结束IfEnd Ifskip2:结束SubPrivate子Form_MouseMove(按钮作为整数,转变为整数,X,Y是作为一个单独的单)Form1.标题= \"三维制图[X:“& X和Y:“& Y &“]”端接头