如何在点上放置空间vb.net [英] how to put space in points vb.net

查看:152
本文介绍了如何在点上放置空间vb.net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只想用固定长度的字符串填充列表框,如下所示.

abc dddee
abd efgr

问题是,由于我使用的字符大小不同,第二列在某些情况下无法正确对齐,如下所示.我没有使用打印机友好的字体.

abc dddee
nlk efgr

如果我测量"abc"和"nlk"的大小.点测量有所不同.如果我设法在点上放置空格或任何其他方式来调整它,那么我也许能够正​​确对齐第二列.

如何使其运作?谢谢

Hi, I just want to populate list box with strings seperated by fixed length as shown below.

abc dddee
abd efgr

The problem is the second column doesn''t align properly in some cases because of the size difference of the characters I used as shown below. I am not using a printer friendly font.

abc dddee
nlk efgr

If I measure the size of "abc" and "nlk" . It is different in point measurement. If I manage to put spaces in points or any other way to adjust it then I may able to align the second column properly.

How to make it work? Thanks

推荐答案

您可以使用固定大小的字体显示,例如:Courier New.
You can Use Fixed Size Font for Display for eg: Courier New.


使用其他字体或使用制表符,至少会适应一点差异.

您总是可以尝试使用给定的字体来测量字符串的大小,然后相应地添加空格.

我的意思示例可以在此处找到[ ^ ]在C#中.

此处 [ ^ ]在VB中.

我想这对您来说是一个很好的起点.

PS:我已将google与该搜索字符串一起使用:使用非固定字体获取字符串的宽度

祝你好运!
Use a different font or use tabs, at least it will adapt a little bit the differences.

You can always try to get the measurement of the strings given the used font and then add spaces accordingly.

A sample of what I mean can be found here[^] in C#.

Here[^] in VB.

I guess this will be a good starting point for you.

PS: I''ve used google with this search string: get width of string using non fixed font

Good luck!


这篇关于如何在点上放置空间vb.net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆