阅读:2442回复:8
一段 vb+mapx 的源代码!
Private Sub Command1_Click()
Dim LayerinfoObject As New MapXLib.LayerInfo Dim Conn As New ADODB.Connection Dim Rec As New ADODB.Recordset LayerinfoObject.Type = 4 LayerinfoObject.AddParameter "ConnectString", "UID=mapinfo;PWD=123" LayerinfoObject.AddParameter "toolkit", "ORAINET" LayerinfoObject.AddParameter "cache", "off" LayerinfoObject.AddParameter "mbrsearch", "on" On Error Resume Next LayerinfoObject.AddParameter "name", "lysgrid2" LayerinfoObject.AddParameter "query", "select * from lysgrid2" Map1.Layers.Add LayerinfoObject, 4 LayerinfoObject.AddParameter "name", "lyslabel" LayerinfoObject.AddParameter "query", "select * from lyslabel" Map1.Layers.Add LayerinfoObject, 1 LayerinfoObject.AddParameter "name", "lysmain" LayerinfoObject.AddParameter "query", "select * from lysmain" Map1.Layers.Add LayerinfoObject, 2 LayerinfoObject.AddParameter "name", "lysmainx" LayerinfoObject.AddParameter "query", "select * from lysmainx" Map1.Layers.Add LayerinfoObject, 3 Map1.Bounds = Map1.Layers(2).Bounds If Conn.State = adStateOpen Then Conn.Close Conn.ConnectionString = "Provider = OraOLEDB.Oracle.1;Password=123;User ID=mapinfo;Persist Security Info=True" Conn.Open If Rec.State = adStateOpen Then Rec.Close Rec.Open "select n1,n2,bh from lysmain", Conn, adOpenDynamic, adLockReadOnly Rec.MoveFirst Do While Not Rec.EOF If Rec!bh <> "" Then Map1.Annotations.AddText Rec!bh, Rec!n1 + 5, Rec!n2 - 18, miPositionCC End If Rec.MoveNext Loop Rec.Close Set Rec = noting Conn.Close Set Conn = Nothing End Sub Private Sub Command2_Click() Unload Me End Sub Private Sub Form_Load() Map1.Layers.RemoveAll End Sub Private Sub Form_Resize() Map1.Move Map1.Left, Map1.Top, ScaleWidth - Map1.Left - 1500, ScaleHeight - Map1.Top - 1500 End Sub Private Sub Map1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) If buttton = 2 Then Map1.PropertyPage End If End Sub 显示逻辑图! 是别人做的,我把它搞上来了!呵呵:) |
|
|
2楼#
发布于:2003-11-27 18:03
辛苦!支持!
建议有空把下载图层定义成一个函数,那就更好了! |
|
3楼#
发布于:2003-11-27 20:06
xiexie
|
|
4楼#
发布于:2004-06-12 10:47
强烈支持<img src="images/post/smile/dvbbs/em04.gif" />
|
|
5楼#
发布于:2004-06-22 11:56
<img src="images/post/smile/dvbbs/em01.gif" />
|
|
6楼#
发布于:2004-08-18 12:14
<P>看看了</P>
|
|
7楼#
发布于:2004-10-10 06:25
<img src="images/post/smile/dvbbs/em01.gif" /><img src="images/post/smile/dvbbs/em02.gif" />
|
|
8楼#
发布于:2004-10-10 06:29
<img src="images/post/smile/dvbbs/em02.gif" />
|
|
9楼#
发布于:2004-10-10 15:28
<P>好呀!!!!</P>
|
|
|