MapWinGIS:SampleCode-VB Net:MaxLabelScale

This is a back-up of the WIKI.
Not all links might work
We're working on a new wiki.

Main Page | Recent changes | View source | Page history | Log in / create account |

Printable version | Disclaimers | Privacy policy

Hide Labels when Zoomed Out

This snippet shows how to use the Extents_Changed Event to determine whether or not to display the labels. Remember to use the same logic when adding the labels.

     'Global Integer layerHandle
 
     Private Sub AxMap1_ExtentsChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles AxMap1.ExtentsChanged
         'Only labels if we are zoomed in past a certain point
         Dim ext As MapWinGIS.Extents
         ext = AxMap1.Extents
         '1 in this case is 1 decimal degree in latitude/longitude
         If ext.xMax - ext.xMin > 1 Or ext.yMax - ext.yMin > 1 Then
             If AxMap1.get_LayerLabelsVisible(layerHandle) = True Then
                 AxMap1.set_LayerLabelsVisible(LayerHandle, False)
             End If
         Else
             If AxMap1.get_LayerLabelsVisible(layerHandle) = False Then
                 AxMap1.set_LayerLabelsVisible(LayerHandle, True)
             End If
         End If
     End Sub

Posted by Shade1974 on 12/12/2005

Retrieved from "http://mapwindow.org/wiki/index.php/MapWinGIS:SampleCode-VB_Net:MaxLabelScale"

This page has been accessed 3,197 times. This page was last modified on 12 December 2005, at 18:30.