Hello.
I have a problem with Labels.VisibilityExpression. the expression with the shapefile works, but with the labels dosn`t work, any idea?
Thanks
My code.
Private Sub CheckedNode_CollectionChanged(sender As Object, e As System.Collections.Specialized.NotifyCollectionChangedEventArgs)
Dim query As String = “”
ShapeMarcasIncidencia.DefaultDrawingOptions.Visible = True
ShapeMarcasIncidencia.Labels.Visible = True
For x = 0 To checkedNode.Count - 1
If checkedNode.Item(x).Tag IsNot Nothing Then
If x = 0 Then
query = "[MWShapeID] = " + checkedNode.Item(x).Tag.ToString + “”
Else
query += " OR [MWShapeID] = " + checkedNode.Item(x).Tag.ToString + “”
End If
End If
Next
If checkedNode.Count = 0 Then
ShapeMarcasIncidencia.DefaultDrawingOptions.Visible = False
ShapeMarcasIncidencia.Labels.Visible = False
Else
ShapeMarcasIncidencia.VisibilityExpression = query
ShapeMarcasIncidencia.Labels.VisibilityExpression = query
End If
AxMap1.Redraw()
End Sub
It looks like your last parameter to the AddLabel method is incorrect.
The last parameter should specify the Label Category index, not the Shape or Label index. Since you are not using label categories, you should just let that default to -1.
Hello @jerryfaust
Thanks i only was trying,
But with -1 is the same result, i don’t know why.
I can`t apply the visibility expression at labels, but in the shapes works very well.
Regards.
Thanks for your help.
Very good. That’s the ideal solution, and the more traditional way you would add shape-based labels.
Rather than adding what might be considered ad-hoc labels, the Generate command creates labels specifically associated with each shape. In this case, I don’t think you need the “Labels.VisibilityExpression”, since the Label visibility should now follow the Shape visibility.