Private Sub CommandButton1_Click()
If TextBox1 > 0 And TextBox2 > 0 Then
TextBox3 = "该点在第一象限"
End If
If TextBox1 > 0 And TextBox2 < 0 Then
TextBox3 = "该点在第二象限"
End If If TextBox1 <0 And TextBox2 >0 Then
TextBox3 = "该点在第三象限"
End If If TextBox1 <0 And TextBox2 < 0 Then
TextBox3 = "该点在第四象限"
End If If TextBox1 = 0 Then
TextBox3 = "该点y轴上"
End If If TextBox2 = 0 Then
TextBox3 = "该点x轴上"
End IfEnd Sub
扩展资料:
求点的坐标的方法:
1、求线段长法
根据点到x轴的距离等于该点纵坐标的绝对值,到y轴距离等于该点横坐标的绝对值,只要能够确定该点到x、y轴的距离,再结合点所在的象限写出点的坐标;
2、代入法
若已知该点的横坐标或纵坐标,可将已知的坐标代入点所在函数的解析式来求另一坐标;
3、交点法
把点看作两条函数图象的交点,求出两函数的解析式,并将它们联立成方程组,解这个方程组得到的x、y就是交点的横、纵坐标;
4、列方程(组)法
设出点的坐标(x ,y),列出关于x或y的方程(组),解出x、y可得结果。
参考资料来源:百度百科-点坐标
Option ExplicitPrivate Sub Command1_Click()
If Not IsNumeric(Text1) Or Not IsNumeric(Text2) Then
MsgBox "无效数字"
Exit Sub
End IfIf Val(Text1) * Val(Text2) > 0 Then
If Val(Text1) > 0 Then
MsgBox "第一象限"
Else
MsgBox "第三象限"
End If
ElseIf Val(Text1) * Val(Text2) < 0 Then
If Val(Text1) > 0 Then
MsgBox "第四象限"
Else
MsgBox "第二象限"
End If
Else
If Val(Text1) = 0 And Val(Text2) <> 0 Then
MsgBox "在Y轴上"
ElseIf Val(Text1) <> 0 And Val(Text2) = 0 Then
MsgBox "在X轴上"
Else
MsgBox "在原点"
End If
End If
End SubPrivate Sub Form_Load()
Label1.Caption = "X:": Label2.Caption = "Y:"
Text1.Text = 1: Text2.Text = 2
Command1.Caption = "确定"
End Sub
Private Sub CommandButton1_Click()
If TextBox1 > 0 And TextBox2 > 0 Then
TextBox3 = "该点在第一象限"
End If
If TextBox1 > 0 And TextBox2 < 0 Then
TextBox3 = "该点在第二象限"
End If If TextBox1 <0 And TextBox2 >0 Then
TextBox3 = "该点在第三象限"
End If If TextBox1 <0 And TextBox2 < 0 Then
TextBox3 = "该点在第四象限"
End If If TextBox1 = 0 Then
TextBox3 = "该点y轴上"
End If If TextBox2 = 0 Then
TextBox3 = "该点x轴上"
End IfEnd Sub