Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Results 1 to 10 of 10

How to change line thickness and color

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 ...

  1. #1
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137

    How to change line thickness and color

    Eric,

    How do you change line thickness and color when you call Addshape to draw different line thickness, color of circles and rectangles?

    Thanks.

  2. #2
    sthurlock is offline Junior Member Yellow Belt
    Join Date
    Dec 2003
    Posts
    12
    Here is code from an addin where a shape has been selected before the addin is called:

    Code:
           Set objShape = objMap.Selection
           objShape.Line.ForeColor = vbRed
    you can use the .weight property to change the thickness.

    sthurlock

  3. #3
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    What is the type of objShape?

    Thanks.

  4. #4
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137

  5. #5
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    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.

  6. #6
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    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

  7. #7
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    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

  8. #8
    sthurlock is offline Junior Member Yellow Belt
    Join Date
    Dec 2003
    Posts
    12
    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

  9. #9
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    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.

  10. #10
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    Yes, when you have a method that returns a shape object, you can save the reference to that object and then change its properties.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Change color of arrow
    By Shragel in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 07-12-2006, 08:28 PM
  2. Change Background Color of Map
    By wadams in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 06-05-2006, 10:34 AM
  3. Mappoint 2004 Line thickness problem ?
    By Danny in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 05-30-2005, 01:27 PM
  4. Change color of Text Balloon
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 05-17-2004, 08:26 AM
  5. Can I change the color of the over-all map? We wa....
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 08-29-2000, 01:56 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59