Shape Fill Color and Label Color Not Working

Jun 23, 2011 at 7:31 AM


I'd tried with New Release 4.8.3 but found problem in Shape Fill & Label Color. When i try to apply color scheme based on field values it not works as expected. Also, the label color is not working. My code snipped is as - 

 Dim sfWorld As New MapWinGIS.Shapefile

        Dim hndWorld As Integer
        Dim LabelText As String
        Dim LabelColor As UInt32 = Convert.ToUInt32(RGB(0, 0, 255))
        Dim X As Double
        Dim Y As Double
        Dim FillColor As UInt32
        Dim LineColor As UInt32
        Dim LineWidth As Single
        Dim rgn As Int16


        hndWorld = AxMap1.AddLayer(sfWorld, True)

        AxMap1.set_ShapeLayerDrawFill(hndWorld, True)

        FillColor = Convert.ToUInt32(RGB(Color.SpringGreen.R, Color.SpringGreen.G, Color.SpringGreen.B))
        LineColor = Convert.ToUInt32(RGB(255, 0, 0))
        LineWidth = 1.0
        AxMap1.CursorMode = MapWinGIS.tkCursorMode.cmSelection

        For i As Int32 = 0 To sfWorld.NumShapes - 1
            rgn = sfWorld.CellValue(5, i)
            Select Case rgn
                Case 1
                    AxMap1.set_ShapeFillColor(hndWorld, i, Convert.ToUInt32(RGB(0, 255, 0)))
                Case 2
                    AxMap1.set_ShapeFillColor(hndWorld, i, Convert.ToUInt32(RGB(Color.Pink.R, Color.Pink.G, Color.Pink.B)))
                Case Else
                    AxMap1.set_ShapeFillColor(hndWorld, i, Convert.ToUInt32(RGB(255, 0, 0)))
            End Select

            LabelText = sfWorld.CellValue(3, i)
            X = sfWorld.Shape(i).Centroid.x
            Y = sfWorld.Shape(i).Centroid.y
            AxMap1.AddLabel(hndWorld, LabelText, LabelColor, X, Y, MapWinGIS.tkHJustification.hjCenter)
        AxMap1.set_ShapeLayerLineColor(hndWorld, LineColor)
        AxMap1.set_ShapeLayerLineWidth(hndWorld, LineWidth)


Jun 24, 2011 at 10:55 AM

In the new version of MapWinGIS things are done somewhat differently.

Here is sample code:

Jun 24, 2011 at 2:41 PM

Thanks Very Much.