VB经纬度与图幅号的相互转换程序.doc

上传人:仙人指路1688 文档编号:2389333 上传时间:2023-02-17 格式:DOC 页数:10 大小:38KB
返回 下载 相关 举报
VB经纬度与图幅号的相互转换程序.doc_第1页
第1页 / 共10页
VB经纬度与图幅号的相互转换程序.doc_第2页
第2页 / 共10页
VB经纬度与图幅号的相互转换程序.doc_第3页
第3页 / 共10页
VB经纬度与图幅号的相互转换程序.doc_第4页
第4页 / 共10页
VB经纬度与图幅号的相互转换程序.doc_第5页
第5页 / 共10页
点击查看更多>>
资源描述

《VB经纬度与图幅号的相互转换程序.doc》由会员分享,可在线阅读,更多相关《VB经纬度与图幅号的相互转换程序.doc(10页珍藏版)》请在三一办公上搜索。

1、VB经纬度与图幅号转换程序代码1 Form1(图3.1)程序代码:(1) Command1:Private Sub Command1_Click()If Option1.Value = True Then Form1.Hide Form2.ShowElseIf Option2.Value = True Then Form1.Hide Form3.ShowElseIf Option1.Value = False And Option2.Value = False Then MsgBox 请选择模式!, 48, 错误提示End IfEnd Sub(2) Command2: Private Sub

2、Command2_Click()EndEnd Sub (3) Command3:Private Sub Command3_Click()a = 软件介绍:b = 本软件适用于我国范围内的经纬度与地形图图幅号相互转换c = 联系方式:QQ 497159625d = a + vbCrLf + b + vbCrLf + ce = MsgBox(d, 0, 关于)End Sub2 Form2(图3.2)程序代码:(1)Form:Private Sub Form_Load()Text3.Enabled = FalseEnd Sub(2)Command1:Private Sub Command1_Clic

3、k()If Text1.Text = Or Text2.Text = Or Val(Text1.Text) 138 Or Val(Text2.Text) 60 ThenMsgBox 请正确输入经纬度!, 48, 错误提示End Ifj = Val(Text1.Text)w = Val(Text2.Text)jd = Int(j) + (Int(j * 100) Mod 100) / 60 + (j * 10000) Mod 100) / 3600wd = Int(w) + (Int(w * 100) Mod 100) / 60 + (w * 10000) Mod 100) / 3600x =

4、Int(wd) Mod 4 + wd - Int(wd)y = Int(jd) Mod 6 + jd - Int(jd)a = Chr(Int(wd / 4) + 65)b = Str(Int(jd / 6) + 31)If Option1.Value = True Then Text3.Text = a & bElseIf Option2.Value = True Then c = 2 - Int(x / 2) d = Int(y / 3) + 1 h = Format(c, 000) l = Format(d, 000)Text3.Text = a & b & B & h & & lEls

5、eIf Option3.Value = True Then c = 4 - Int(x / 1) d = Int(y / 1.5) + 1 h = Format(c, 000) l = Format(d, 000) Text3.Text = a & b & C & h & & lElseIf Option4.Value = True Then c = 12 - Int(x / (1 / 3) d = Int(y / 0.5) + 1 h = Format(c, 000) l = Format(d, 000) Text3.Text = a & b & D & h & & lElseIf Opti

6、on5.Value = True Then c = 24 - Int(x / (1 / 6) d = Int(y / 0.25) + 1 h = Format(c, 000) l = Format(d, 000) Text3.Text = a & b & E & h & & lElseIf Option6.Value = True Then c = 48 - Int(x / (1 / 12) d = Int(y / (1 / 8) + 1 h = Format(c, 000) l = Format(d, 000) Text3.Text = a & b & F & h & & lElseIf O

7、ption7.Value = True Then c = 96 - Int(x / (1 / 24) d = Int(y / (23 / 400) + 1 h = Format(c, 000) l = Format(d, 000) Text3.Text = a & b & G & h & & lElseIf Option8.Value = True Then c = 192 - Int(x / (1.25 / 60) d = Int(y / (0.03125) + 1 h = Format(c, 000) l = Format(d, 000) Text3.Text = a & b & H &

8、h & & lElseMsgBox 请先选择比例尺!, 48, 错误提示End IfEnd Sub(2)Command2:Private Sub Command2_Click()Text1.Text = Text2.Text = Text3.Text = End Sub(3)Command3:Private Sub Command3_Click()a = 我国经度范围 72138b = 我国纬度范围052c = 请输入我国范围内的经纬度:d = 例:392230则输入:39.2230e = a + vbCrLf + b + vbCrLf + c + vbCrLf + df = MsgBox(e

9、, 0, 输入说明:)End Sub(4)Command4:Private Sub Command4_Click()Form2.HideForm1.ShowEnd Sub(5)Command5:Private Sub Command5_Click()EndEnd Sub3 Form3(图3.3)程序代码:(1) Command1:If Text1.Text = A Or Text1.Text = a Then a = 1ElseIf Text1.Text = B Or Text1.Text = b Then a = 2ElseIf Text1.Text = C Or Text1.Text =

10、c Then a = 3ElseIf Text1.Text = D Or Text1.Text = d Then a = 4ElseIf Text1.Text = E Or Text1.Text = e Then a = 5ElseIf Text1.Text = F Or Text1.Text = f Then a = 6ElseIf Text1.Text = G Or Text1.Text = g Then a = 7ElseIf Text1.Text = H Or Text1.Text = h Then a = 8ElseIf Text1.Text = I Or Text1.Text =

11、i Then a = 9ElseIf Text1.Text = J Or Text1.Text = j Then a = 10ElseIf Text1.Text = K Or Text1.Text = k Then a = 11ElseIf Text1.Text = L Or Text1.Text = l Then a = 12ElseIf Text1.Text = M Or Text1.Text = m Then a = 13ElseIf Text1.Text = N Or Text1.Text = n Then a = 14Else MsgBox 请输入我国范围内的图幅行号!, 48, 错

12、误提示End IfIf Val(Text2.Text) 53 Or Text1.Text = Or Text2.Text = Or Text4.Text = Or Text5.Text = Then MsgBox 请输入我国范围内的图幅列号!, 48, 错误提示End If b = Val(Text2.Text)h = Format(Text4.Text, #)l = Format(Text5.Text, #)c = Val(h)d = Val(l) If Text3.Text = A Or Text3.Text = a Then jd = (b - 31) * 6 + (d - 1) * 6

13、 wd = (a - 1) * 4 + (4 / 4 - c) * 4 Text6.Text = Int(jd) Text7.Text = Int(jd - Int(jd) * 60) Text8.Text = CInt(jd - Int(jd) * 60 - Val(Text7.Text) Text9.Text = Int(wd) Text10.Text = Int(wd - Int(wd) * 60) Text11.Text = CInt(wd - Int(wd) * 60 - Val(Text10.Text) ElseIf Text3.Text = B Or Text3.Text = b

14、 Then jd = (b - 31) * 6 + (d - 1) * 3 wd = (a - 1) * 4 + (4 / 2 - c) * 2 Text6.Text = Int(jd) Text7.Text = Int(jd - Int(jd) * 60) Text8.Text = CInt(jd - Int(jd) * 60 - Val(Text7.Text) Text9.Text = Int(wd) Text10.Text = Int(wd - Int(wd) * 60) Text11.Text = CInt(wd - Int(wd) * 60 - Val(Text10.Text) El

15、seIf Text3.Text = C Or Text3.Text = c Then jd = (b - 31) * 6 + (d - 1) * 1.5 wd = (a - 1) * 4 + (4 / 1 - c) * 1 Text6.Text = Int(jd) Text7.Text = Int(jd - Int(jd) * 60) Text8.Text = CInt(jd - Int(jd) * 60 - Val(Text7.Text) Text9.Text = Int(wd) Text10.Text = Int(wd - Int(wd) * 60) Text11.Text = CInt(

16、wd - Int(wd) * 60 - Val(Text10.Text)ElseIf Text3.Text = D Or Text3.Text = d Then jd = (b - 31) * 6 + (d - 1) * 0.5 wd = (a - 1) * 4 + (4 / (1 / 3) - c) * (1 / 3) Text6.Text = Int(jd) Text7.Text = Int(jd - Int(jd) * 60) Text8.Text = CInt(jd - Int(jd) * 60 - Val(Text7.Text) Text9.Text = Int(wd) Text10

17、.Text = Int(wd - Int(wd) * 60) Text11.Text = CInt(wd - Int(wd) * 60 - Val(Text10.Text) ElseIf Text3.Text = E Or Text3.Text = e Then jd = (b - 31) * 6 + (d - 1) * 0.25 wd = (a - 1) * 4 + (4 / (1 / 6) - c) * (1 / 6) Text6.Text = Int(jd) Text7.Text = Int(jd - Int(jd) * 60) Text8.Text = CInt(jd - Int(jd

18、) * 60 - Val(Text7.Text) Text9.Text = Int(wd) Text10.Text = Int(wd - Int(wd) * 60) Text11.Text = CInt(wd - Int(wd) * 60 - Val(Text10.Text) ElseIf Text3.Text = F Or Text3.Text = f Then jd = (b - 31) * 6 + (d - 1) * 7.5 wd = (a - 1) * 4 + (4 / (1 / 12) - c) * (1 / 12) Text6.Text = Int(jd) Text7.Text =

19、 Int(jd - Int(jd) * 60) Text8.Text = CInt(jd - Int(jd) * 60 - Val(Text7.Text) Text9.Text = Int(wd) Text10.Text = Int(wd - Int(wd) * 60) Text11.Text = CInt(wd - Int(wd) * 60 - Val(Text10.Text) ElseIf Text3.Text = G Or Text3.Text = g Then jd = (b - 31) * 6 + (d - 1) * (23 / 400) wd = (a - 1) * 4 + (4

20、/ (1 / 24) - c) * (1 / 24) Text6.Text = Int(jd) Text7.Text = Int(jd - Int(jd) * 60) Text8.Text = CInt(jd - Int(jd) * 60 - Val(Text7.Text) Text9.Text = Int(wd) Text10.Text = Int(wd - Int(wd) * 60) Text11.Text = CInt(wd - Int(wd) * 60 - Val(Text10.Text) ElseIf Text3.Text = H Or Text3.Text = h Then jd

21、= (b - 31) * 6 + (d - 1) * (0.03125) wd = (a - 1) * 4 + (4 / (1.25 / 60) - c) * (1.25 / 60) Text6.Text = Int(jd) Text7.Text = Int(jd - Int(jd) * 60) Text8.Text = CInt(jd - Int(jd) * 60 - Val(Text7.Text) Text9.Text = Int(wd) Text10.Text = Int(wd - Int(wd) * 60) Text11.Text = CInt(wd - Int(wd) * 60 -

22、Val(Text10.Text) Else MsgBox 请输入正确的比例尺代码, 48, 错误提示:End IfEnd Sub(2)Command2:Private Sub Command2_Click()Text1.Text = Text2.Text = Text3.Text = Text4.Text = Text5.Text = Text6.Text = Text7.Text = Text8.Text = Text9.Text = Text10.Text = Text11.Text = End Sub(3)Command3:Private Sub Command3_Click()Form

23、3.HideForm1.ShowEnd Sub(4)Command4:Private Sub Command4_Click()EndEnd Sub(5)Command5:Private Sub Command5_Click()a = 我国地形图图幅行号代码范围:ANb = 我国地形图图幅列号范围:4353c = 请输入我国范围内的图幅行列号!d = 例: J 50 则应输入 J 50 A 001 001e = a + vbCrLf + b + vbCrLf + c + vbCrLf + df = MsgBox(e, 0, 输入说明:)End Sub(6) Text1:Private Sub T

24、ext1_Change()If Len(Text1.Text) = 1 ThenText2.SetFocusEnd IfEnd Sub(7) Text2:If Len(Text2.Text) = 2 ThenText3.SetFocusEnd IfEnd Sub(8)Text3: Private Sub Text3_Change()If Len(Text3.Text) = 1 ThenText4.SetFocusEnd IfEnd Sub(9)Text4:Private Sub Text4_Change()If Len(Text4.Text) = 3 ThenText5.SetFocusEnd IfEnd Sub

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 建筑/施工/环境 > 项目建议


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号