VB程序 判断坐标所在象限
Private Sub Command1_Click()Dim x!, y!, n%n = InStr(Text1, ",")If n = 0 Then MsgBox "输入错误!!!请重新输入!
PrivateSubCommand1_Click() Dimx!,y!,n% n=InStr(Text1,",") Ifn=0Then MsgBox"" 输入错误!!!请重新输入! Text1="" Text1.SetFocus Else x=Val(Left(Text1,n-1)) y=Val(Mid(Text1,n+1)) SelectCasex CaseIs<0 Ify<0Then MsgBox"("&x&","&y&")",vbInformation,"" 是在第三象限中消息框 ElseIfy=0Then MsgBox"("&x&","&y&")x",vbInformation,"" 是在轴负半轴上消息框 Else:MsgBox"("&x&","&y&")",vbInformation,"" 是在第二象限中消息框 EndIf CaseIs>0 Ify<0Then MsgBox"("&x&","&y&")",vbInformation,"" 是在第四象限中消息框 ElseIfy=0Then MsgBox"("&x&","&y&")x",vbInformation,"" 是在轴正半轴上消息框 Else:MsgBox"("&x&","&y&")",vbInformation,"" 是在第一象限中消息框 EndIf CaseElse Ify<0Then MsgBox"("&x&","&y&")y",vbInformation,"" 是在轴负半轴上消息框 ElseIfy=0Then MsgBox"("&x&","&y&")",vbInformation,"" 是坐标原点消息框 Else:MsgBox"("&x&","&y&")y",vbInformation,"" 是在轴正半轴上消息框 EndIf EndSelect EndIf EndSub PrivateSubCommand2_Click() Text1="" Text1.SetFocus EndSub

