Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Arrange the texts that are larger than your box.


iHero
 Share

Recommended Posts

The code that does this in CS:DE is very heavy, I simplified it.

```
Public Function MakeText(text As String, ChatWidth As Long) As String

Dim n As Long

Dim TextWidth As Long, MinText As String

For n = 1 To Len(text)

MinText = Mid$(text, n, 1)

TextWidth = TextWidth + frmMain.TextWidth(MinText)

If TextWidth > ChatWidth Then

MakeText = MakeText & vbNewLine

TextWidth = 0

Else

MakeText = MakeText & MinText

End If

Next

End Function
```

But there is one problem: when it will add a new line, he cuts a letter. I'm leaving, if someone can fix I appreciate it.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...