1、第一次作业 程序化线图处理一题目线图的程序化处理:上机:将下图编程实现(大作业)二解题思路本线图为分区域线图,对功率和转速需要进行分段讨论,采用Visual Basci 软件可实现匹配类型的功能,使用用 if 语句实现各个区域分段,而各个区域的分界线为直线和斜线,它们都可以通过解线性方程而获得,以各个分界线列方程用 And 语句即可实现题目所要求的功能。可将功率的范围分为 0.81,12.6, 2.64, 46,612, 1223,2337220800 等多个区域,然后分别列出各个区域相关的方程组,即可有 Visual Basic 编程实现功能。3程序代码Private Sub Form_Lo
2、ad()Picture = LoadPicture(App.Path + “1.jpg“)End SubPrivate Sub Command1_Click()Dim x As DoubleDim y As DoubleIf Not IsNumeric(Text1.Text) ThenMsgBox “请在输入功率时输入数字“, , “警告“Text1.Text = “Text1.SetFocusEnd IfIf Not IsNumeric(Text2.Text) ThenMsgBox “请输入转速时输入数字“, , “警告“Text2.Text = “Text2.SetFocusEnd Ifx
3、 = Text1.Texty = Text2.TextIf x = 0.8 And x = 0.8 And x 1350 * (x - 4 / 9) And y = 1 And x = 1 And x = 200 * (x - 0.5) And y = 1 And x = 1350 * (x - 4 / 9) And y = 2.6 And x = 2.6 And x = (1000 / 18) * (x - 0.8) And y = 2.6 And x = 200 * (x - 0.5) And y = 2.6 And x = 1350 * (x - 4 / 9) And y = 4 And
4、 x = 4800 And y = 4 And x = 100 And y = 4 And x = (1000 / 18) * (x - 0.8) And y = 4 And x = 200 * (x - 0.5) And y = 6 And x = 100 And y = 6 And x = (250 / 7) * (x - 16 / 5) ThenMsgBox “您选择的类型为 C 型!“ElseIf x = 6 And x = (500 / 9) * (x - 0.8) And y = 6 And x = 200 * (x - 0.5) And y = 12 And x = 3500 A
5、nd y = 12 And x = 100 And y = 12 And x = (250 / 7) * (x - 16 / 5) And y = 12 And x = (500 / 9) * (x - 0.8) ThenMsgBox “您选择的类型为 B 型!“ElseIf x = 23 And x = 2800 And y = 18 And x = 100 And y = 18 And x = 12.5 * (x - 10) And y = 18 And x = (250 / 7) * (x - 16 / 5) And y = 23 And x = (250 / 7) * (x - 16
6、/ 5) And y = 23 And x = 12.5 * (x - 10) ThenMsgBox “您选择的类型为 D 型!“ElseIf x = 23 And x = 100 And y = 37 And x = 12.5 * (x - 10) And y = 37 And x = 1500 And y = 46 And x = 12.5 * (x - 10) And y = 46 And x = 100 And y = 46 And x = (25 / 6) * (x - 22) ThenMsgBox “您选择的类型为 E 型!“ElseIf x = 85 And x = 100 And y = 85 And x = (25 / 6) * (x - 22) And y = 85 And x = 1100 And y = 220 And x = 700 And y = 220 And x = 100 And y = 700 ThenMsgBox “您选择的类型为 F 型!“Else: MsgBox “您选择的点不在所规定的范围之内,请重新输入!“End IfEnd Sub4运行结果截图五小结通过此次作业我学会了如使用 Visual Basic 编程实现一些简单的数据查找功能,同时,因为图表中的分段很多,做题的时候也使我体会到了耐心和细心的重要性。