MapWinGIS:SampleCode-VB Net:ColorScheme

This is a back-up of the WIKI.
Not all links might work
We're working on a new wiki.

Main Page | Recent changes | View source | Page history | Log in / create account |

Printable version | Disclaimers | Privacy policy

ColorScheme

This example shows how to use the colorschemes.

     Private Sub ApplyLegendColorsSample()
 
         Dim mwLayerHandle As Long
         Dim mwColSheme As MapWinGIS.ShapefileColorScheme
         Dim mwColBreak As MapWinGIS.ShapefileColorBreak
         Dim i As Long
         Dim sf As New MapWinGIS.Shapefile
 
         'Open a shapefile
         sf.Open("C:\Program Files\MapWindow\Sample Projects\United States\Shapefiles\states.shp")
 
         'Add it to the map
         mwLayerHandle = AxMap1.AddLayer(sf, False)
 
         'Initialize a new ShapefileColorScheme object (make sure to assign the layer handle it goes with)
         mwColSheme = New MapWinGIS.ShapefileColorScheme
         mwColSheme.LayerHandle = mwLayerHandle
         mwColSheme.FieldIndex = 0
 
         'Make a color ramp from red to blue for the states with area = 0 to 100000
         mwColBreak = New MapWinGIS.ShapefileColorBreak
         mwColBreak.Caption = "First Break"
         mwColBreak.StartValue = "0"
         mwColBreak.EndValue = "100000"
         mwColBreak.StartColor = Convert.ToUInt32(RGB(255, 0, 0))
         mwColBreak.EndColor = Convert.ToUInt32(RGB(0, 0, 255))
         mwColSheme.Add(mwColBreak)
 
         'Make a color ramp from green to white for the states with area = 1000000 to 300000
         mwColBreak = New MapWinGIS.ShapefileColorBreak
         mwColBreak.Caption = "First Break"
         mwColBreak.StartValue = "100000"
         mwColBreak.EndValue = "300000"
         mwColBreak.StartColor = Convert.ToUInt32(RGB(0, 255, 0))
         mwColBreak.EndColor = Convert.ToUInt32(RGB(255, 255, 255))
         mwColSheme.Add(mwColBreak)
 
 
         'Apply it to the map layer
         AxMap1.ApplyLegendColors(mwColSheme)
 
         'Set the layer visibility to true
         AxMap1.set_LayerVisible(mwLayerHandle, True)
 
     End Sub

Wiki post by Shade1974 on 12/12/2005
Copied from code posted by Dan Ames in MapWinGIS Phorum

Retrieved from "http://mapwindow.org/wiki/index.php/MapWinGIS:SampleCode-VB_Net:ColorScheme"

This page has been accessed 2,910 times. This page was last modified on 12 December 2005, at 18:09.