# Assign a Color to a Shape

**URL:** <https://mapwindow.discourse.group/t/assign-a-color-to-a-shape/835>\
**Category:** Uncategorized\
**Created:** [December 17, 2020, 8:31am UTC](https://mapwindow.discourse.group/t/assign-a-color-to-a-shape/835 "2020-12-17T08:31:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![colleen](https://avatars.discourse-cdn.com/v4/letter/c/f19dbf/32.png) [@colleen](https://mapwindow.discourse.group/u/colleen)\
**Post date:** [December 17, 2020, 8:31am UTC](https://mapwindow.discourse.group/t/assign-a-color-to-a-shape/835/1 "2020-12-17T08:31:29Z")

</div>

Hi  
I am sure this is an easy thing to do, but I cannot find out how to do this outside of a shape file. I see in the old documentation that you can use Map1.ShapeFillColor but it no longer seems to work. I am zooming to a shape and want to make just that shape a different colour eg zoom to a road. I have also looked at the drawing layer but there does not seem to be anything to draw just that shape. Even better would be able to zoom to a shape and flash that shape as a different colour 3 times. Does anyone have any ideas on this?

Regards

Colleen Crawford

---

<div class="post-metadata">

**Author:** ![stu](https://avatars.discourse-cdn.com/v4/letter/s/3ec8ea/32.png) [@stu](https://mapwindow.discourse.group/u/stu)\
**Post date:** [December 17, 2020, 9:56am UTC](https://mapwindow.discourse.group/t/assign-a-color-to-a-shape/835/2 "2020-12-17T09:56:55Z")

</div>

Hi Collen

I have a Access VBA application that highlights a road in yellow, and zooms to the feature. The code is as follows:

The shapefile name is ShapeFile\_Roads\_Undev . Transparency values are 0 to 255 .

```
'-------------------
' Undeveloped Roads
'-------------------

    Undev_Road = 0
        For Undev_Road = 0 To ShapeFile_Roads_Undev.NumShapes - 1
               If ShapeFile_Roads_Undev.CellValue(FieldNumber, Undev_Road) = Spatial_ID Then
                     shapenumber = Undev_Road
                     
                     
                    ShapeFile_Roads_Undev.ShapeSelected(Undev_Road) = True

                                ShapeFile_Roads_Undev.SelectionDrawingOptions.LineWidth = 8
                                ShapeFile_Roads_Undev.Selectable = True
                                ShapeFile_Roads_Undev.SelectionTransparency = 255
                                ShapeFile_Roads_Undev.SelectionColor = vbYellow
                                
                                ShapeFile_Roads_Undev.SelectionAppearance = saDrawingOptions
                                 
                            'Set Label Values ------------------------------------------------------------------------------------
                                 x = ShapeFile_Roads_Undev.Shape(Undev_Road).Point(0).x
                                 y = ShapeFile_Roads_Undev.Shape(Undev_Road).Point(0).y
                                 
                                 LabelText = ShapeFile_Roads_Undev.CellValue(FieldNumber, Undev_Road)
                                 
                                 ShapeFile_Roads_Undev.Labels.OffsetX = 10
                                 ShapeFile_Roads_Undev.Labels.OffsetY = -10
                                       
                                 ShapeFile_Roads_Undev.Labels.Alignment = laTopRight
                                 ShapeFile_Roads_Undev.Labels.FrameBackColor = vbYellow
                                 ShapeFile_Roads_Undev.Labels.FontColor = vbBlack
                                 MapLabel = ShapeFile_Roads_Undev.Labels.InsertLabel(Undev_Road, LabelText, x, y, angleRotation, -1)
                             '-------------------------------------------------------------------------------------------------------
                     ZoomSkip = True
                     GoTo foundRecord
               End If
         Next Undev_Road

```

foundRecord:

'------------------------------------------  
’ Zoom to Asset  
'------------------------------------------

ZoomToAsset = Map0.ZoomToShape(zoom\_layer, shapenumber)

---

<div class="post-metadata">

**Author:** ![colleen](https://avatars.discourse-cdn.com/v4/letter/c/f19dbf/32.png) [@colleen](https://mapwindow.discourse.group/u/colleen)\
**Post date:** [December 17, 2020, 1:22pm UTC](https://mapwindow.discourse.group/t/assign-a-color-to-a-shape/835/3 "2020-12-17T13:22:24Z")

</div>

Thank you - I had just figured it out and came to post. I did not know how to select the shape I had zoomed to but see that it is very easy.  
With shpRdLineBackground  
.ShapeSelected(i) = True  
.SelectionColor = vbGreen  
.SelectionTransparency = 255  
’ It seems this is the default - it puts a very thin green line on the edges of the Road  
.SelectionAppearance = saSelectionColor  
End With

---

<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:10pm UTC](https://mapwindow.discourse.group/t/assign-a-color-to-a-shape/835/4 "2022-01-05T15:10:42Z")

</div>


