Quantcast
Channel: MapWinGIS ActiveX Map and GIS Component
Viewing all articles
Browse latest Browse all 2341

New Post: Creating Legend in VB.net

$
0
0
well, you can use this as a guide
     _'Collect first all the data you need in your Database_
    iDataAdapter = New SqlClient.SqlDataAdapter("Select Everything in your Database", SqlConnection.ConnectionString.ToString)
    iDataAdapter.Fill(iDataSet, "TableName")
    If iDataSet.Tables(0).Rows.Count <= 0 Then
        Exit Sub
    End If

    Dim xCount As New Integer
    _'this will loop to all your Object/Shape and compare the column(IDPROV) in your shape to the column(IDPROV) in your Dataset_
    While xCount <> iDataSet.Tables(0).Rows.Count
        For I = 0 To MyShape.NumShapes - 1
            If MyShape.CellValue(0, I) = iDataSet.Tables("TableName").Rows.Item(xCount).Item(0).ToString Then _'If the data is same_ 
                MyShape.ShapeSelected(I) = True
                LabelText =  iDataSet.Tables("TableName").Rows.Item(xCount).Item(1).ToString _'This will get the value of your column(1)= "Sex Ratio and display it inside the shape that match your criteria_
                ex = MyShape.Shape(I).Extents 'identify the location
                X = (ex.xMax + ex.xMin) / 2
                Y = (ex.yMax + ex.yMin) / 2
                Map.AddLabel(4, LabelText, Convert.ToUInt32(RGB(0, 255, 150)), X, Y, MapWinGIS.tkHJustification.hjCenter) _'Finally display the Text Data from you Database_
                Map.LayerFont(4, "Arial Narrow", 8)
            End If
        Next
        xCount = xCount + 1
    End While
hope this helps

Viewing all articles
Browse latest Browse all 2341

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>