Eric,
How do you change line thickness and color when you call Addshape to draw different line thickness, color of circles and rectangles?
Thanks.
This is a discussion on How to change line thickness and color within the MapPoint Desktop Discussion forums, part of the Map Forums category; Eric, How do you change line thickness and color when you call Addshape to draw different line thickness, color of ...
Eric,
How do you change line thickness and color when you call Addshape to draw different line thickness, color of circles and rectangles?
Thanks.
Here is code from an addin where a shape has been selected before the addin is called:
you can use the .weight property to change the thickness.Code:Set objShape = objMap.Selection objShape.Line.ForeColor = vbRed
sthurlock
What is the type of objShape?
Thanks.
It's a shape object.
Hi there,
I tried this, but I run into runtime error. It is because the objshape has not been set or added. Can you select the shape before it has been added to the map?
Thanks.
This is my code:
Dim objmap As MapPointCtl.Map
Dim objloc As MapPointCtl.Location
Dim objshape As MapPointCtl.Shape
Set objmap = Me.MappointControl1.ActiveMap
Set objloc = objmap.GetLocation(wp0.lat, wp0.lon)
Set objshape = objmap.Selection
objshape.line.ForeColor = color
objshape.line.Weight = 1
objmap.Shapes.AddShape geoShapeRadius, objloc, 0.001, 0.001
I need to change the color and thickness of the line that I just added to the map. How can I do it? The following code does not work because nothing has been selected. Thanks.
'Add a Line from one location to the other
objmap.Shapes.AddLine objloc0, objloc1
Set objshape = objmap.Selection
objshape.line.ForeColor = color
objshape.line.Weight = 1
Sorry I wasn't more clear. The code I gave before was from an addin that was called after the user had created and then selected a shape. In your code, you don't need to select it, you just need to grab the reference to the Shape object that is returned when you do the addline, then change the properties:
Code:Set objshape = objmap.Shapes.AddLine objloc0, objloc1 objshape.line.ForeColor = color objshape.line.Weight = 1
Thank you, sthurlock. I will try this.
Can you do the same thing if it is Autoshape (eg.rectangle, circle) instead of Shapes.AddLine?
Thank you very much.
Yes, when you have a method that returns a shape object, you can save the reference to that object and then change its properties.
There are currently 1 users browsing this thread. (0 members and 1 guests)