Hello and hi.
i draw textbox in form1 and run it.
i type " abc1234 " in textbox1 and result " abc1234 "
but i type " abc1234 " textbox1 result " a b c 1 2 3 4 " only some distance between all text
i not know code
Printable View
Hello and hi.
i draw textbox in form1 and run it.
i type " abc1234 " in textbox1 and result " abc1234 "
but i type " abc1234 " textbox1 result " a b c 1 2 3 4 " only some distance between all text
i not know code
for example input of html using css
letter-spacing: 1px;
when i type in input some distance between all typing
how can vb6 program
Code:Set Me.Font = textbox1.Font
Distance = Me.TextWidth(textbox1.Text)
for example input of html using css
letter-spacing: 1px;
when i type in input some distance between all typing
how can vb6 program
As Eduardo- was explaining, the Width is a function of the selected font and font size used.
So it may vary. The Textbox does NOT have a way to compute the Font Width.
However the form does. It is .TextWidth and .TextHeight.
SO by putting 1 character only into the Textbox) you can determine the Font Width for that
particular font and size. There is NO spacing between individual characters, just
white space that is part of the width of any single character in a font.
Depending whether the font is a Fixed Type, True Type, etc. the rendering of them is a
complicated (lot of things to consider) process.
Search for True Type font and get ready to learn a lot.
Hi,
It's not very clear what you are exactly asking.
Do you expect something like below?
(Check the attached sample also for your easiness.)
Attachment 161267
Code:Option Explicit
Private Sub Text1_Change()
Text2.Text = GetTxtWithSpaces(Text1)
End Sub
Private Function GetTxtWithSpaces(tbx As TextBox) As String
Dim i As Integer, txt As String
With tbx
For i = 1 To Len(.Text)
txt = txt & Mid$(.Text, i, 1) & " "
Next
End With
GetTxtWithSpaces = RTrim$(txt)
End Function
Thanks
u write
but not include space only distance character
I believe it's called kerning.
Don't know whether this is possible in a textbox, maybe a RichTextBox
This might not be what you need, but just for an idea with a PictureBox.
Attachment 161281
Some useful links:Code:Option Explicit
Private Sub Text1_Change()
Call SetTracking(Text1.Text, 40)
End Sub
Private Sub SetTracking(txt As String, charspace As Byte)
Dim Char As String
Dim i As Byte
With Picture1
.Cls
.FontSize = Text1.FontSize
.FontName = Text1.Font
For i = 1 To Len(txt)
Char = Mid(txt, i, 1)
Picture1.Print Char;
.CurrentX = .CurrentX + charspace
Next
End With
End Sub
https://docs.microsoft.com/en-us/win...g--and-spacing
https://msdn.microsoft.com/en-us/lib...(v=vs.85).aspx
This is a unicode vs ascii problem. VB6 is taking the leading 0 and converting it into a space character instead of ignoring it. This is why every letter is preceded by a blank space.
Change your IME or check its settings. You may have an option to ignore the leading space. There is also a setting for "non-unicode programs" you can search for and change to your preferred language.