I can add labels with this code to my overlay but cannot remove them. A simple menu item toggle on and off is all this is.
I may be oversimplifying this.
Private Sub Designations_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Designations.ClickDim plRegionNTextStyle As New TextStyle("Designation", New GeoFont("Arial", 12, DrawingFontStyles.Italic), New GeoSolidBrush(GeoColor.StandardColors.Black))Dim plRegionSETextStyle As New TextStyle("Designation", New GeoFont("Arial", 12, DrawingFontStyles.Italic), New GeoSolidBrush(GeoColor.StandardColors.Black))Dim plRegionSWTextStyle As New TextStyle("Designation", New GeoFont("Arial", 12, DrawingFontStyles.Italic), New GeoSolidBrush(GeoColor.StandardColors.Black))If Designations.Checked = False Then
The styles are defined in the method body, when you click the second time, the style you declare is another instance of styles, so you cannot remove the original styles. Please move the styles’ declaration to the class body.
I thought I put in the correct tags for the previous post, why did it not format properly? Maybe this post will work. I moved them with the same results, I can add them but not remove them. Public Class frmLoad
Private plRegionNTextStyle As New TextStyle("Designation", New GeoFont("Arial", 12, DrawingFontStyles.Italic), New GeoSolidBrush(GeoColor.StandardColors.Black)) Private plRegionSETextStyle As New TextStyle("Designation", New GeoFont("Arial", 12, DrawingFontStyles.Italic), New GeoSolidBrush(GeoColor.StandardColors.Black)) Private plRegionSWTextStyle As New TextStyle("Designation", New GeoFont("Arial", 12, DrawingFontStyles.Italic), New GeoSolidBrush(GeoColor.StandardColors.Black))
I did notice I was removeing the style from level01, I changed it to the level I was applying it to 15. I ran it again and everything applied to level 15 was removed. Can just removing or clearing a customtextstyle not be done? It should be.
Applying the style from zoomlevel01 to zoomlevel15 just like copy the styles from 01 to 15, so if you cleaning the 01’s style, there is nothing can be copy.
The ApplyUntilZoomLevel can allow you to copy the the contents of a ZoomLevel to other ZoomLevels like Gary mentioned. This can be used to apply styles to multiple ZoomLevels or to remove styles from multiple ZoomLevels.
For your scenario you have two choices. You can be very exacting with your removal and remove a specific TextStyle from each ZoomLevel by using something like:
It is important to note that the ApplyUntilZoomLevel copies the entire set of ZoomLevel settings so be sure you want all the settings from a ZoomLevel before applying those setting to an entire group of ZoomLevels.