I have a normal command button and I want to print some unicode text on it. And as I'm sure you know, you cannot do this. What I've tried to do though is:
1) trap the WM_PAINT message for this control
2) Clear the Caption of the button (so no text is printed)
3) Process the WM_PAINT message on the original hook (to draw the button)
4) Then use DrawTextW to draw my text on the button.
This works on Picturebox controls, but Textbox, Checkbox, and Command Button controls do notThey just display a thing black filled box for each character with a white background. Can anyone help me?
Api
After i've trapped WM_PAINT, i run this code:Code:Private Declare Function DrawTextW Lib "user32" (ByVal hdc As Long, ByVal lpStr As Long, ByVal nCount As Long, lpRect As RECT, ByVal wFormat As Long) As Long
The CUni just converts some text to aribic unicode values. (I'm just using this as a test, not production, normally it would come from external file) Item.Item is the command button, and Item.hwnd maps to Item.Item.hWndCode:Item.Item.Caption = CUni("tesT") SubClassChild = CallOldWindowProc(hWnd, iMsg, wParam, lParam) Dim tmpHdc As Long: tmpHdc = GetDC(Item.hWnd) Dim tRect As RECT tRect.Left = 3 tRect.Top = 3 tRect.Right = 30 tRect.Bottom = 30 DrawTextW tmpHdc, StrPtr(CUni("test")), -1, tRect, 0 ReleaseDC Item.hWnd, tmpHdc




They just display a thing black filled box for each character with a white background. Can anyone help me?
Reply With Quote