Public Class MainForm Dim a,b,c,d,e1,f,g,h,k1,k1i,k2,k2i,x1,x2,y1,y2 As Single Dim D_,D1,D2,D3,D4 As Single Private Sub Form1_Load(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles MyBase.Load txt_a.Text = "3" txt_b.Text = "2" txt_c.Text = "5" txt_d.Text = "1" txt_k1.Text = "10" txt_k1i.Text = "0" txt_e.Text = "5" txt_f.Text = "2" txt_g.Text = "3" txt_h.Text = "4" txt_k2.Text = "5" txt_k2i.Text = "0" End Sub Private Sub
退出ToolStripMenuItem_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles
退出ToolStripMenuItem.Click Dim strExit As String strExit = "您确定要停止运行吗?" If vbNo = Msg
Box(strExit,vbQuestion Or vbYesNo,"") Then Exit Sub End If End End Sub Private Sub Button_Clean_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles Button_Clean.Click clean() End Sub Private Sub Button_run_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles Button_run.Click If (txt_a.Text <> "" And txt_b.Text <> "" And txt_c.Text <> "" And txt_d.Text <> "" And txt_k1.Text <> "" And txt_k1i.Text <> "" And txt_e.Text <> "" And txt_f.Text <> "" And txt_g.Text <> "" And txt_h.Text <> "" And txt_k2.Text <> "" And txt_k2i.Text <> "") Then Call Msg
Box("参数正常!",vbExclamation,"
提示") Try a = Val(txt_a.Text) b = Val(txt_b.Text) c = Val(txt_c.Text) d = Val(txt_d.Text) k1 = Val(txt_k1.Text) k1i = Val(txt_k1i.Text) e1 = Val(txt_e.Text) f = Val(txt_f.Text) g = Val(txt_g.Text) h = Val(txt_h.Text) k2 = Val(txt_k2.Text) k2i = Val(txt_k2i.Text) Catch Call Msg
Box("参数输入失败,请输入数字!","
提示") End Try Try D_ = sijiehanglieshijishuan(a,-b,-f,-h,a,g) D1 = sijiehanglieshijishuan(k1,-d,g) D2 = sijiehanglieshijishuan(a,g) D3 = sijiehanglieshijishuan(a,g) D4 = sijiehanglieshijishuan(a,0) x1 = D1 / d x2 = D2 / d y1 = D3 / d y2 = D4 / d lab_x1.Text = x1 lab_x2.Text = x2 lab_y1.Text = y1 lab_y2.Text = y2 'lab_tip.Text = Val("D=" + D_ + "**D1=" + D1 + "**D2=" + D2 + "**D3=" + D3 + "**D1=" + D4 + "**D1=" + D4) Catch ex As Exception Call Msg
Box("计算出错抛出,请确认参数正确!","
提示") lab_x1.Text = "" lab_x2.Text = "" lab_y1.Text = "" lab_y2.Text = "" End Try Else Call Msg
Box("参数不正常。","
提示") End If End Sub Private Sub clean() txt_a.Text = "" txt_b.Text = "" txt_c.Text = "" txt_d.Text = "" txt_k1.Text = "" txt_k1i.Text = "" txt_e.Text = "" txt_f.Text = "" txt_g.Text = "" txt_h.Text = "" txt_k2.Text = "" txt_k2i.Text = "" lab_x1.Text = "" lab_x2.Text = "" lab_y1.Text = "" lab_y2.Text = "" Call Msg
Box("清除参数。","
提示") End Sub Private Function sijiehanglieshijishuan(ByVal A11 As Single,ByVal A12 As Single,ByVal A13 As Single,ByVal A14 As Single,ByVal A21 As Single,ByVal A22 As Single,ByVal A23 As Single,ByVal A24 As Single,ByVal A31 As Single,ByVal A32 As Single,ByVal A33 As Single,ByVal A34 As Single,ByVal A41 As Single,ByVal A42 As Single,ByVal A43 As Single,ByVal A44 As Single) Dim jiguo As Single Try jiguo = A11 * A22 * A33 * A44 - A11 * A22 * A34 * A43 - A11 * A23 * A32 * A44 + A11 * A23 * A34 * A42 + A11 * A24 * A32 * A43 - A11 * A24 * A33 * A42 - A12 * A21 * A33 * A44 + A12 * A21 * A34 * A43 + A12 * A23 * A31 * A44 - A12 * A23 * A34 * A41 - A12 * A24 * A31 * A43 + A12 * A24 * A33 * A41 + A13 * A21 * A32 * A44 - A13 * A21 * A34 * A42 - A13 * A22 * A31 * A44 + A13 * A22 * A34 * A41 + A13 * A24 * A31 * A42 - A13 * A24 * A32 * A41 - A14 * A21 * A32 * A43 + A14 * A21 * A33 * A42 - A14 * A22 * A31 * A43 - A14 * A22 * A33 * A41 - A14 * A23 * A31 * A42 + A14 * A23 * A32 * A41 Catch ex As Exception End Try Return jiguo End Function Private Sub 重置所有参数ToolStripMenuItem_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles 重置所有参数ToolStripMenuItem.Click clean() End Sub Private Sub 联系作者ToolStripMenuItem_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles 联系作者ToolStripMenuItem.Click Call Msg
Box("作者QQ:389465553,广石化短号:620319","
提示") End Sub End Class
原文链接:https://www.f2er.com/vb/259408.html