# How to change the color of a layer in map

**URL:** <https://mapwindow.discourse.group/t/how-to-change-the-color-of-a-layer-in-map/313>\
**Category:** Uncategorized\
**Created:** [October 25, 2019, 3:12pm UTC](https://mapwindow.discourse.group/t/how-to-change-the-color-of-a-layer-in-map/313 "2019-10-25T15:12:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lang](https://avatars.discourse-cdn.com/v4/letter/l/0ea827/32.png) [@lang](https://mapwindow.discourse.group/u/lang)\
**Post date:** [October 25, 2019, 3:12pm UTC](https://mapwindow.discourse.group/t/how-to-change-the-color-of-a-layer-in-map/313/1 "2019-10-25T15:12:37Z")

</div>

Hello,

I select a layer and then go to a context menu property to change the layer’s color.  
This seems very simple, but it got me. Will someone share some code?  
Thanks!

---

<div class="post-metadata">

**Author:** ![jerryfaust](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/jerryfaust/32/378_2.png) [@jerryfaust](https://mapwindow.discourse.group/u/jerryfaust)\
**Post date:** [October 25, 2019, 6:28pm UTC](https://mapwindow.discourse.group/t/how-to-change-the-color-of-a-layer-in-map/313/2 "2019-10-25T18:28:16Z")

</div>

Hello @lang

Each layer has it’s own set of [ShapeDrawingOptions](https://www.mapwindow.org/documentation/mapwingis4.9/class_shape_drawing_options.html) that control the default rendering. This can be accessed through the Shapefiles [DefaultDrawingOptions](https://www.mapwindow.org/documentation/mapwingis4.9/class_shapefile.html#ab50d2c01b4848368852ea87cbcf6e5d4) property.

There are also some [top-level (AxMap) functions](https://www.mapwindow.org/documentation/mapwingis4.9/group __map__ shapefile.html) that can be used to set the various properties in each Shapefiles ShapeDrawingOptions. You might try starting with these.

Regards.

---

<div class="post-metadata">

**Author:** ![lang](https://avatars.discourse-cdn.com/v4/letter/l/0ea827/32.png) [@lang](https://mapwindow.discourse.group/u/lang)\
**Post date:** [October 25, 2019, 8:46pm UTC](https://mapwindow.discourse.group/t/how-to-change-the-color-of-a-layer-in-map/313/3 "2019-10-25T20:46:01Z")

</div>

Thank you Jerry!  
Is the following ok? how do we set the color exactly? Can I pass in my own color?  
Utils utils = new Utils();  
sf = axMap1.get\_Shapefile(layerHandle);  
ShapeDrawingOptions options = sf.DefaultDrawingOptions;  
options.FillColor = utils.ColorByName(tkMapColor.Red);

```
        axMap1.Redraw();
```

---

<div class="post-metadata">

**Author:** ![pmeems](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/pmeems/32/9_2.png) [@pmeems](https://mapwindow.discourse.group/u/pmeems)\
**Post date:** [January 5, 2022, 3:08pm UTC](https://mapwindow.discourse.group/t/how-to-change-the-color-of-a-layer-in-map/313/4 "2022-01-05T15:08:53Z")

</div>


