' 女性と男性の比率に応じてマップ エレメントに色を付けます Private Sub statesLayer_Imported(ByVal sender As Object, ByVal e As MapLayerImportEventArgs) Dim layer As MapLayer = TryCast(sender, MapLayer) ' ブラシを宣言します Dim b1 As New SolidColorBrush(Colors.Orange) Dim b2 As New SolidColorBrush(Color.FromArgb(255, 30, 144, 255)) For Each element As MapElement In layer.Elements Dim males As Double = CDbl(element.GetProperty("MALES")) Dim females As Double = CDbl(element.GetProperty("FEMALES")) Dim ratio As Double = Math.Round(females / males, 2) element.ToolTip = String.Format("{0:F2}", females / males) element.Caption = DirectCast(element.GetProperty("STATE_ABBR"), String) ' 比率をチェックして色を設定します If ratio > 1 Then element.Fill = b1 Else element.Fill = b2 End If Next End Sub