DrawString word wrapping issue

I’m working on a custom listbox / grid and I’m using graphic StringWidth() to wrap the text in cells. I’ve circled the issues I’m having in red. The first issue ( top-left ) I believe is caused by only one word on the first line, which is to long for the cell width. I think I can easily work around that. The second issue (lower-right). The method doesn’t seem to be wrapping correctly after the word “There”. I would have expected the next word or two after “There” to be added to the line before wrapping occurred.

Is this normal behavior for StringWidth() or should I be looking at my code a little closer?

Johnny, your picture is not showing.
https://www.dropbox.com/s/0no1enbgeizfujn/Capture.PNG?dl=0

Are you positive there is no extra spaces or endOfLine after There ?

Thanks Michel

When I try to embed the url between the img tags, nothing shows up.

[quote=335601:@Johnny Harris]Thanks Michel

When I try to embed the url between the img tags, nothing shows up.[/quote]

I noticed. Then don’t bother, simply paste the URL as I did.

Change the url to raw=1

I use stringwidth to wrap text precisely. You should look more closely at your code.

Thanks Tim,

The data for the listbox is coming from an Sqlite (Chinook.db) database. I used Sqlite Expert to enter some extra text and it must have added some line endings. I copied the text from the database into notepad and removed the line endings. Then used Valentina Studio to re-enter the text and now it displays correctly. Other data from the database seems to wrap correctly.

Thanks Neil… that’s some handy information.