MapPoint Forums

MapForums

Community of MapPoint and Virtual Earth Users and Developers




Fixing a TextBox Size

This is a discussion on Fixing a TextBox Size within the MapPoint 2006/2009 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, ...


Go Back   MapPoint Forums > Map Forums > MapPoint 2006/2009 Discussion

Today's Posts Twitter Feed Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read



Click here to register

Reply

 

LinkBack (1) Thread Tools Display Modes
  1 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 10-12-2007
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 05:34 AM.. Reason: fix
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 10-16-2007
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,177
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
fixing, size, textbox


LinkBacks (?)
LinkBack to this Thread: http://www.mapforums.com/fixing-textbox-size-6524.html

Posted By For Type Date
MapPoint Download - MP2K Magazine This thread Refback 10-14-2007 02:16 AM

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

Thread Thread Starter Forum Replies Last Post
Arrow size Anonymous MapPoint 2006/2009 Discussion 0 10-14-2004 02:43 PM
Polyline Size Anonymous MapPoint 2006/2009 Discussion 4 09-29-2004 06:08 AM
Different image size webjagger MapPoint 2006/2009 Discussion 0 06-24-2004 07:14 AM
Fixing Printing Problems in MP Anonymous MapPoint 2006/2009 Discussion 2 03-17-2004 09:56 AM
size of a territory Anonymous MapPoint 2006/2009 Discussion 0 11-04-2003 05:23 PM


All times are GMT -5. The time now is 04:50 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0 RC2
MP2K Magazine
Visitor Map

Madeira Holiday
Why not book a Madeira holiday through UlookUbook and enjoy this warm Portuguese island at a bargain price!



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