如何让文本框包含每个字符下的字符位置
我在MS-ACCESS 2007表单(其旧,但我所称)上有一个文本框,称为text_record。我想在文本框中显示字符,该字符在文本下方的位置线直接显示。例如,
ABCDEF
123456
我使用以下代码来设置字段:
dim x as string
x = Forms![mapped field names].Form![text_record] & vbcrlf
For i = 1 To Len(x) - 1
x = x & CStr(i Mod 10)
Next
Forms![mapped field names].Form![text_record] = x
代码有效并显示下面的整数位置,但是字符并未直接对齐数字上方。我需要直接上方的角色,以便用户可以看到特定列中的内容。
我尝试了几种不同的字体类型,都说它们是单独的,并且它们都无法直接对准该数字。根据记录中的文字,该位置的关闭高达5列。
我一定缺少简单的东西。
事先感谢您的所有答复
I have a text box on an MS-Access 2007 Form (its old, but its what I have) called text_record. I want to display the characters in the text box with a positional line directly underneath the text. e.g.
ABCDEF
123456
I used the following code to set the field:
dim x as string
x = Forms![mapped field names].Form![text_record] & vbcrlf
For i = 1 To Len(x) - 1
x = x & CStr(i Mod 10)
Next
Forms![mapped field names].Form![text_record] = x
The code works and shows the integer positions underneath, but the characters are not aligned directly above the numbers. I need the characters directly above the positional number so a user can see what is in a particular column.
I tried several different font types, all said they were monospaced, and they all fail to align directly above the number. Depending on the text in the record, the position was off as much as 5 columns.
I must be missing something simple.
Thanks in advance for any and all responses
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用固定字体。快递新的是固定尺寸。
因此,在表单上,我放在文本框中,就在另一个文本框下方
(我将边框设置为透明,然后设置启用= false(因此用户无法编辑或选项卡)。
因此,我们有:
和两个文本框的字体是这样:
和我的代码(在您键入时将数字放在下面)。
因此,我们看到了(我在“ I”和“ L”中键入,因为它们与数字相比很小,并且我们得到了以下:
因此,不确定您使用了哪种字体,但是Courier New是固定字体,应该按照上述功能工作。
Use a fixed font. Courier New is a fixed size.
So, on the form, I drop in a text box, and right below another text box
(I set the border to transparent, and I set enabled = false (so user can't edit, or tab into).
so we have this:
And the font for both text boxes is this:
And my code (it puts numbers below as you type).
So, we see this (and I typed in "i" and "l", since they are small compared to numbers, and we get this:
so, not sure what font you used, but Courier new is a fixed font, and should work as per above.
您最好将文本分开并将其放入多列列表框中。
You might be better off splitting the text and putting it into a multi-column list box.