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 2 of 2

Fixing a TextBox Size

This is a discussion on Fixing a TextBox Size within the MapPoint Desktop Discussion forums, part of the Map Forums category; Hi, i'm using textboxes to mark some places on the map customizing the text. I use: Code: tbox = Shapes.AddTextbox(Location, ...

  1. #1
    Gianmaria is offline Member Yellow Belt
    Join Date
    Dec 2004
    Posts
    47

    Exclamation Fixing a TextBox Size

    Hi,
    i'm using textboxes to mark some places on the map customizing the text.

    I use:

    Code:
    tbox = Shapes.AddTextbox(Location, 1, 1);
    and later i modify the size to adapt to the text:

    Code:
    tBox.Width = getWidthByString(textToDisplay);
    the getWidthByString is a my custom function that calculate the size analyzing the string and adding 11pts if a char is lower and 12pts if a char is upper:

    Code:
    private int getWidthByString(string name)
            {
                int w = 0;
                foreach (char c in name)
                {
                    if (Char.IsLower(c)) { w += 11; }
                    if (Char.IsUpper(c)) { w += 12; }
                }
                return w;
            }
    but this seem to dont have a regular behaviuor.. i always have txtboxes larger than i need....


    Any Idea?

    Gianmaria
    Last edited by Gianmaria; 10-12-2007 at 06:34 AM. Reason: fix

  2. #2
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433

    Re: Fixing a TextBox Size

    Hi,

    The text is proportional font. A lot of characters are the same size, but for the smaller and larger ones you have to put a case statement in your width calculation routine.

    I think the most easy is to make a textbox with all characters in it. Then copy the map with textbox to clipboard, then paste it in your favourite picture editor and zoom it in and count the pixels for each character.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Arrow size
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 10-14-2004, 03:43 PM
  2. Polyline Size
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 4
    Last Post: 09-29-2004, 07:08 AM
  3. Different image size
    By webjagger in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 06-24-2004, 08:14 AM
  4. Fixing Printing Problems in MP
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 03-17-2004, 10:56 AM
  5. size of a territory
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 11-04-2003, 06:23 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 60 61 62 63 64 65 66