DT_WORDBREAK Breaks words. Lines are automatically broken between words if a word would extend past the edge of the rectangle specified by the lpRect parameter. A carriage return-line feed sequence also breaks the line.
If this is not specified, output is on one line.
Option Explicit
Private Declare Function DrawText Lib "user32.dll" Alias "DrawTextA" (ByVal hdc As Long, ByVal lpStr As String, ByVal nCount As Long, lpRect As RECT, ByVal wFormat As Long) As Long
Private Const DT_CENTER As Long = &H1
Private Const DT_WORDBREAK As Long = &H10
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Sub Form_Load()
Me.ScaleMode = vbPixels
Me.Caption = "Resize me..."
End Sub
Private Function s(p As String, ByVal c As Long) As String
For c = 1 To c
s = s & p
Next
End Function
Private Sub Form_Resize()
Dim r As RECT
r.Right = Me.ScaleWidth
r.Bottom = Me.ScaleHeight
Me.Cls
DrawText Me.hdc, s("Гы! ", 50), Len("Гы! ") * 50, r, DT_CENTER Or DT_WORDBREAK
End Sub
Сейчас этот форум просматривают: AhrefsBot и гости: 171