Hello list.
 
I created a nice integrated mapping solution in vb.net, with this I can
- Open a workspace
- Zoom in/Zoom out
- Resize my Mapwindow
 
What you need to do in VS 2005 is:
1. Add a picturebox to a form
2. Dock this picturebox to the form
 
And then implement the following sample code to the form
Declare Function MoveWindow Lib "user32" (ByVal hWnd As Integer, ByVal x As Integer, ByVal y As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal bRepaint As Integer) As Integer

Public Sub New()

Dim sMsg As String

' This call is required by the Windows Form Designer.

InitializeComponent()

MapInfo = CType(CreateObject("MapInfo.Application"), MapInfo.DMapInfo)

sMsg = "Set Next Document Parent " & CType(Me.picMapWindow.Handle, String) & " Style 1"

MapInfo.Do(sMsg)

sMsg = "run application ""D:\Care\04\04.wor"""

MapInfo.Do(sMsg)

End Sub

 

Private Sub picMapWindow_SizeChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles picMapWindow.SizeChanged

Dim mHwnd As Long

If Not MapInfo Is Nothing Then

mHwnd = Val(MapInfo.Eval("WindowInfo(FrontWindow(),12)"))

MoveWindow(mHwnd, 0, 0, picMapWindow.Size.Width, picMapWindow.Size.Height, 0)

End If

End Sub

 

Private Sub ToolStripButtonZoomEntire_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButtonZoomEntire.Click

MapInfo.Do(" Set map Zoom entire")

End Sub

 

Private Sub ToolStripButtonZoomIn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButtonZoomIn.Click

MapInfo.RunMenuCommand(1705)

End Sub

 

Private Sub ToolStripZoomOut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripZoomOut.Click

MapInfo.RunMenuCommand(1706)

End Sub

 

I am now at the point where I want to responde to a mouse click in my Mapwindow for this I try to use a callback:

Private Sub ToolStripButtonInfo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButtonInfo.Click

MapInfo.Do("Create Buttonpad ""SelectGeneric"" As Toolbutton ID 785 DrawMode 34 Cursor 134 Calling OLE ""SelectGeneric""")

MapInfo.Do("Run Menu Command ID 785")

MapInfo.SetCallback(mycallback)

End Sub

 
Mycallback is a class I created. However, with no change I can get this class to respond to SetStatusText and WindowChanged
 
 
Is there anybody that knows if there are some things I am ovelooking?
 
Kind regards,
 
Milo van der Linden
_______________________________________________
MapInfo-L mailing list
[email protected]
http://www.directionsmag.com/mailman/listinfo/mapinfo-l

Reply via email to