Page 1 of 1

Label control

Posted: 29 Nov 2007, 05:28
by godeny
Hello TiKu,

your unicode-capable control set is a great collection!
Thank you for them!

I was also looking for a unicode label control (my application is translatable by the user), and found the FlatButton control, with it's BorderLayoutModel = blmNeverShowBorder setting. Perhaps you could say alrady in your "What is FlatButton" post, that it is also a replacement for the simplest control.

Zoltan

Posted: 29 Nov 2007, 10:36
by TiKu
Sorry to say this, but FlatButton isn't Unicode-capable.

Posted: 29 Nov 2007, 10:46
by godeny
:-(

Is there a way - another control - which can be turned to a label control ?

Posted: 29 Nov 2007, 12:14
by TiKu
A label more or less is for displaying text only. It shouldn't be that difficult to do the same task with Unicode support. Have a look at the TextOut API function.
Something like this should work (not tested):

Code: Select all

Private Declare Function TextOut Alias "TextOutW" Lib "gdi32.dll" (ByVal hDC As Long, ByVal nXStart As Long, ByVal nYStart As Long, ByVal lpString As Long, ByVal cbString As Long) As Long

Dim s As String

s = "Hello World " & ChrW(&H30A1&)
TextOut Me.hDC, 0, 0, StrPtr(s), Len(s)
If you need a more powerful function, you should use the DrawText API function:

Code: Select all

Private Declare Function DrawText Alias "DrawTextW" Lib "user32.dll" (ByVal hDC As Long, ByVal lpString As Long, ByVal nCount As Long, lpRect As RECT, ByVal uFormat As Long) As Long

Posted: 29 Nov 2007, 12:20
by godeny
Yes, when i find nothing, then remains that way.

I have an existing application without unicode support i want to change. So it would be easier to replace the existing VB label controls with another control.