I’m shooting from the hip here (I usually try things before posting but I’ve been coding all day…) but I’d think you could create a text style and add it to CustomStyles (it’s a collection or list or something like that and can hold more than one style) since you can’t define a CustomStyle and a DefaultStyle at the same time or you get an error. It’s not clear if you want the label to show only at under the same conditions as well; if so I’d think you could put the TextStyle in a second ValueStyle coded kind of like your original PointStyle stuck in the ValueStyle.
You want to create a text with its own style where you click, right?
I think you can create your own custom text style and override DrawCore function.
A point is necessary for label text, orelse program don’t know where to locate the label. If you don’t want to see the point, you can ignore to render it on map.
Then when you click on map, you should want to create a featurelayer for this function. You create your own text font builder, then build a feature based on pointshape and save all information in its columnvalues. Assign your custom style to this featurelayer, when drawcore, draw your font follow these information.
I was kind of hoping it would be easier, but this is exactly what I expected. I will create a point with transparent attributes and assign the text to it.
When I call the Draw text. I get the Text drawn. However,
I have a transparent point textP(1)
The Text Object text(1)
and A value "Hello World."
I cant figure out how to use the Text value for display and and the Name to manage the object
This is the routine I am using.
As it stands all that displays is the object name TEXT(1)
Public Sub DrawTextPoint(ByVal name As String, ByVal dtext As String, ByRef lyr As InMemoryFeatureLayer, ByVal fcolor As GeoColor, ByVal fnt As Drawing.Font, ByVal lat As Double, ByVal lon As Double)
’ Clear the Item If it Exists
Try
lyr.InternalFeatures.Remove(name) 'Attempt to remove the feature if it exists.
For i As Integer = 0 To lyr.ZoomLevelSet.ZoomLevel01.CustomStyles.Count - 1
If lyr.ZoomLevelSet.ZoomLevel01.CustomStyles(i).Name = name Then
Public Sub DrawTextPoint(ByVal name As String, ByVal dtext As String, ByRef lyr As InMemoryFeatureLayer, ByVal fcolor As GeoColor, ByVal fnt As Drawing.Font, ByVal lat As Double, ByVal lon As Double)
’ Clear the Item If it Exists
Try
lyr.InternalFeatures.Remove(name) 'Attempt to remove the feature if it exists.
For i As Integer = 0 To lyr.ZoomLevelSet.ZoomLevel01.CustomStyles.Count - 1
If lyr.ZoomLevelSet.ZoomLevel01.CustomStyles(i).Name = name Then
I found my Issue. I forgot to add the new Text column to the Layer
New Problem. I want the user to have the ability to select a font , Size and Style from a Fontdialog.
I tried to Use the System.font.style but it threw an exception on refresh. It also appears to not change the font based on family name. ( The Size Does seem to work Fine.)
It seem that I may have to create a custom Dialog for these settings.
Is the a list of available geofonts and the Style enumerations available.
If is doesn’t exist I intend to Create a Routine GeofontFromSystem()