Hello Charista,
now I see that is done.orry.
Gr.Maurits
2014-02-20 13:37 GMT+01:00 Maurits van Ravesteijn <[email removed]>:
Hello Charista,maybe you have to set AxMap1.sendMouseMove=true (in VB it may be different). That could solve one of your problems.Greetings Maurits2014-02-20 4:01 GMT+01:00 Charista <[email removed]>:From: Charista
i tried to select a point and show their information.
then i found at http://www.mapwindow.org/documentation/mapwingis4.8/_tool_tip_8cs-example.html , and this is the codes (VB.NET) :Unfortunately, i'm still get some errorPublic Partial Class MapMain ' the handle of the drawing layer Private m_drawingHandle As Integer = -1 ' Opens a shapefile, registers event handler Public Sub ToolTip(axMap1 As AxMap, dataPath As String) Dim filename As String = dataPath &"point.shp" If Not File.Exists(filename) Then MessageBox.Show("Couldn't file the file: " & filename) Return End If Dim sf As New Shapefile() sf.Open(filename, Nothing) If Not sf.StartEditingShapes(True, Nothing) Then MessageBox.Show("Failed to start edit mode: " & sf.Table.get_ErrorMsg(sf.LastErrorCode)) Else sf.UseQTree = True sf.Labels.Generate("[Name]", tkLabelPositioning.lpCentroid, False) axMap1.AddLayer(sf, True) axMap1.SendMouseMove = True axMap1.ShowRedrawTime = True axMap1.MapUnits = tkUnitsOfMeasure.umMeters axMap1.CurrentScale = 50000 axMap1.CursorMode = tkCursorMode.cmNone MapEvents.MouseMoveEvent += New AxMapWinGIS._DMapEvents_MouseMoveEventHandler(AddressOf axMap1_MouseMoveEvent) ' change MapEvents to axMap1 Dim m_drawingHandle As Integer = axMap1.NewDrawing(tkDrawReferenceList.dlScreenReferencedList) Dim labels As Labels = axMap1.get_DrawingLabels(m_drawingHandle) labels.FrameVisible = True labels.FrameType = tkLabelFrameType.lfRectangle End If End Sub ' Handles mouse move event. Determines which shape is under cursor. Calls drawing routine. Private Sub axMap1_MouseMoveEvent(sender As Object, e As _DMapEvents_MouseMoveEvent) Dim labels As Labels = axMap1.get_DrawingLabels(0) labels.Clear() ' it's assumed here that the layer we want to edit is the first 1 (with 0 index) Dim layerHandle As Integer = axMap1.get_LayerHandle(0) Dim sf As Shapefile = axMap1.get_Shapefile(layerHandle) If sf IsNot Nothing Then Dim projX As Double = 0.0 Dim projY As Double = 0.0 axMap1.PixelToProj(e.x, e.y, projX, projY) Dim result As Object = Nothing Dim ext As New Extents() ext.SetBounds(projX, projY, 0.0, projX, projY, 0.0) If sf.SelectShapes(ext, 0.0, SelectMode.INTERSECTION, result) Then Dim shapes As Integer() = TryCast(result, Integer()) If shapes.Length = 1 Then Dim s As String = "" For i As Integer = 0 To sf.NumFields - 1 s += sf.Field(i).Name + ": " & sf.CellValue(i, shapes(0)) & vbLf Next labels.AddLabel(s, e.x + 80, e.y, 0.0, -1) Dim shape As Shape = sf.Shape(shapes(0)) End If End If End If axMap1.Refresh() End Sub End Class
i'm newbie using mapwingis, please somebody can help me ?
- 'MapEvents' is not declared. It may be inaccessible due to its protection level
- labels.Clear() : Object reference not set to an instance of an object.
ThankRead the full discussion online.
To add a post to this discussion, reply to this email ([email removed])
To start a new discussion for this project, email [email removed]
You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.
Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online atcodeplex.com