Layers Visibility?

Topics: Algorithms, SharpMap v0.9 / v1.x
Aug 12, 2008 at 1:19 PM
I have a DataGridView, which contains the layers of my map.

and there is a column (CheckBoxDataGridViewColumn) in the DGV

which determines whether this layer should be visible or not.

How Can I let the users control layer visiblity?
Aug 13, 2008 at 4:36 AM
Keep a TAG property (or a grid cell directly) that has the layer name that you used.  Then just do the following (a listview example below so modify it for a grid):

            if (e.Item.Checked)
                mapImage1.Map.Layers[e.Item.Tag.ToString()].Enabled = true;
                mapImage1.Map.Layers[e.Item.Tag.ToString()].Enabled = false;

Aug 13, 2008 at 7:24 AM
Ok, thanks.

I will suppose your code like this way:

mapImage1.Map.Layers[e.Item.Tag.ToString()].Enabled = e.Item.Checked;

anyway, thanks dirkkaiser.