Can an InMemeoryFeatureLayer have more than one TestStyle? Is my method below possible? I tried adding OFFLabels1, yet only OFFLabels will display. What might I pay attention to for this to work? Thanks. I am going to hit submit even though the preview window is space delimiting my code. I hope it displays as it shows in the Format Code Block window preview and as I see it here in Create New Topic.
Private
Sub
Offices_Click(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.EventArgs)
Handles
Offices.Click
If
Offices.Checked =
False
Then
If
command IsNot
Nothing
Then
command =
Nothing
If
dataReader IsNot
Nothing
Then
dataReader =
Nothing
Try
OFFconn.Open()
Offices.Checked =
True
Dim
OfficesTag
As
String
=
“SELECT * FROM Offices ORDER BY ID;”
command =
New
OleDbCommand(OfficesTag, OFFconn)
dataReader = command.ExecuteReader()
Dim
i
As
Integer
If
dataReader.FieldCount > 0
Then
bolOFF =
True
If
Map.Overlays.Contains(
“Offices”
) =
False
Then
OFFLayer =
New
InMemoryFeatureLayer()
OFFLayer1 =
New
InMemoryFeatureLayer()
Dim
OfficesValue
As
New
ValueStyle()
OfficesValue.ColumnName =
“Name”
Do
While
dataReader.Read()
OfficesValue.ValueItems.Add(
New
ValueItem(dataReader(
“Name”
).ToString,
New
PointStyle((
New
GeoImage(Application.StartupPath +
“\ATMOSIconSmall.ico”
)))))
Loop
'create Office Designation/Name label
Dim
OFFLabels
As
TextStyle
OFFLabels =
New
TextStyle(
“Name”
,
New
GeoFont(
“Arial”
, 12),
New
GeoSolidBrush(GeoColor.StandardColors.Black))
OFFLabels.XOffsetInPixel = 10
'OFFLabels.YOffsetInPixel = 7
OFFLabels.Mask =
New
AreaStyle(
New
GeoPen(GeoColor.StandardColors.AntiqueWhite, 1), _
New
GeoSolidBrush(GeoColor.StandardColors.WhiteSmoke))
'create Office Address label
Dim
OFFLabels1
As
TextStyle
OFFLabels1 =
New
TextStyle(
“Address”
,
New
GeoFont(
“Arial”
, 12),
New
GeoSolidBrush(GeoColor.StandardColors.Black))
OFFLabels1.XOffsetInPixel = 10
OFFLabels1.YOffsetInPixel = 10
OFFLabels1.Mask =
New
AreaStyle(
New
GeoPen(GeoColor.StandardColors.AntiqueWhite, 1), _
New
GeoSolidBrush(GeoColor.StandardColors.WhiteSmoke))
'add label layers
OFFLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(OFFLabels)
OFFLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(OFFLabels1)
’ OFFLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(TextStyles.City2("[Name]" & " - " & “[Address]”))
’ OFFLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle.YOffsetInPixel = 50
’ OFFLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle.OverlappingRule = LabelOverlappingRule.AllowOverlapping
OFFLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(OfficesValue)
OFFLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20
OFFLayer.Open()
OFFOverlay.Layers.Add(OFFLayer)
Map.Overlays.Add(
“Offices”
, OFFOverlay)
For
i = 0
To
dataReader.FieldCount - 1
OFFLayer.Columns.Add(
New
FeatureSourceColumn(dataReader.GetName(i)))
OFFstr.Add(dataReader.GetName(i).ToString)
Next
i
End
If
OFFLayer.EditTools.BeginTransaction()
If
command IsNot
Nothing
Then
command =
Nothing
If
dataReader IsNot
Nothing
Then
dataReader =
Nothing
command =
New
OleDbCommand(OfficesTag, OFFconn)
dataReader = command.ExecuteReader()
’ We now loop though all of the results and build up our features that we need to return.
Do
While
dataReader.Read()
Dim
OfficesFeature
As
New
Feature(
CDbl
(dataReader(
“Longitude”
)),
CDbl
(dataReader(
“Latitude”
)))
For
i = 0
To
dataReader.FieldCount - 1
OfficesFeature.ColumnValues(dataReader.GetName(i)) = dataReader(dataReader.GetName(i)).ToString
Next
i
OFFLayer.EditTools.Add(OfficesFeature)
Loop
OFFLayer.EditTools.CommitTransaction()
Else
MessageBox.Show(
“Offices Error!”
+ Environment.NewLine +
“No Records Found!”
,
“Data Error!”
, MessageBoxButtons.OK)
End
If
Catch
ex
As
Exception
MessageBox.Show(
“Offices Error!”
+ Environment.NewLine + ex.Message,
“Connection Error!”
, MessageBoxButtons.OK)
Offices.Checked =
False
Finally
’ Cleanup any of the objects that need to be closed or disposed.
If
command IsNot
Nothing
Then
command.Dispose()
If
dataReader IsNot
Nothing
Then
dataReader.Dispose()
End
Try
Else
Offices.Checked =
False
If
Map.Overlays.Contains(
“Offices”
) =
True
Then
Map.Overlays.Remove(Map.Overlays(
“Offices”
))
OFFconn.Close()
bolOFF =
False
End
If
Map.Refresh()
If
Not
bolLoad
Then
SaveINI()
End
Sub