如何让文本框包含每个字符下的字符位置

发布于 2025-01-22 14:29:20 字数 536 浏览 2 评论 0原文

我在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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

荒人说梦 2025-01-29 14:29:20

使用固定字体。快递新的是固定尺寸。

因此,在表单上,​​我放在文本框中,就在另一个文本框下方
(我将边框设置为透明,然后设置启用= false(因此用户无法编辑或选项卡)。

因此,我们有:

“

和两个文本框的字体是这样:

和我的代码(在您键入时将数字放在下面)。

Private Sub Text0_Change()   
  Dim sResult       As String
  Dim i             As Integer
  
  For i = 1 To Len(Text0.Text)
  
     sResult = sResult & i Mod 10
     
  Next i      
  Me.Text2 = sResult      
End Sub

因此,我们看到了(我在“ 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:

enter image description here

And the font for both text boxes is this:

enter image description here

And my code (it puts numbers below as you type).

Private Sub Text0_Change()   
  Dim sResult       As String
  Dim i             As Integer
  
  For i = 1 To Len(Text0.Text)
  
     sResult = sResult & i Mod 10
     
  Next i      
  Me.Text2 = sResult      
End Sub

So, we see this (and I typed in "i" and "l", since they are small compared to numbers, and we get this:

enter image description here

so, not sure what font you used, but Courier new is a fixed font, and should work as per above.

秋叶绚丽 2025-01-29 14:29:20

您最好将文本分开并将其放入多列列表框中。

You might be better off splitting the text and putting it into a multi-column list box.

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文