Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

How can I count pixels so that columns line up?

How can I count pixels so that columns line up?

How can I count pixels so that columns line up?

If I use a combo or a list box and have a concatinated field with text columns and add spaces so all the fields are the same length I get a twisted sister look in my drop down list.

Is there any way to get thse to line up?

DDDDDDDDDD     10 capital D's then 5 spaces
iiiiiiiiii     10 i's then 5 spaces

I know you can do this with a proportional font but there a only a few and they don't look good.

RE: How can I count pixels so that columns line up?

Hi Edsedlar,
 The simplest solution, as you eluded to, is to use a fixed length font. This is the method I choose to use. Check out Courier New font. It doesnt look as old fashioned as most of its counterparts do. In fact, it is the default VFP text editor font, I believe.
 Your second option is to use columns. Since you are using concatenated fields, Im not so sure this is feasible in your case.
 Last, and definitely the one with the most overhead. Take a look at the TxtWidth() function. You can use it in conjunction with the FontMetric() function to perform the computations you will need.


RE: How can I count pixels so that columns line up?

If the columns are concatenated within the combo box (IOW, not in some SELECT statement), you can use the combo box's ColumnWidths property to specify hard widths for each of the columns making up your combo box.

Robert Bradley

FoxDev - Visual FoxPro Development

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close