Option Explicit
Private Declare Function GetDC Lib "user32.dll" (ByVal hwnd As Long) As Long
Private Declare Function ReleaseDC Lib "user32.dll" (ByVal hwnd As Long, ByVal hdc As Long) As Long
Private Declare Function GetDeviceCaps Lib "gdi32.dll" (ByVal hdc As Long, ByVal nIndex As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Declare Function CreateWindowEx Lib "user32.dll" Alias "CreateWindowExW" ( _
ByVal dwExStyle As Long, _
ByVal lpClassName As Long, _
ByVal lpWindowName As Long, _
ByVal dwStyle As Long, _
ByVal x As Long, _
ByVal y As Long, _
ByVal nWidth As Long, _
ByVal nHeight As Long, _
ByVal hWndParent As Long, _
ByVal hMenu As Long, _
ByVal hInstance As Long, _
lpParam As Any) As Long
Private Const WS_EX_CLIENTEDGE As Long = &H200&
Private Const WS_CHILD As Long = &H40000000
Private Const WS_VISIBLE As Long = &H10000000
Private Const ES_MULTILINE As Long = 4&
Private Const ES_AUTOVSCROLL As Long = &H40&
Private Const ES_NOHIDESEL As Long = &H100&
Private Const ES_WANTRETURN As Long = &H1000&
Dim hWndEdit As Long
Private Sub Form_Load()
Dim yPos As Long
Dim xPos As Long
Dim DefaultText As String
xPos = 0
yPos = 0
DefaultText = "Вставьте список " & ChrW(9733) & vbCrLf & "2 строка."
hWndEdit = CreateWindowEx(WS_EX_CLIENTEDGE, StrPtr("EDIT"), StrPtr(DefaultText), _
WS_CHILD Or WS_VISIBLE Or ES_MULTILINE Or ES_AUTOVSCROLL Or ES_NOHIDESEL Or ES_WANTRETURN, _
xPos, yPos, TwipsToPixels(Me.Width, isXScale:=True), _
TwipsToPixels(Me.Height, isXScale:=False), Me.hwnd, 0&, 0&, ByVal 0&)
End Sub
Private Function TwipsToPixels(lngTwips As Long, isXScale As Boolean) As Long
Const nTwipsPerInch As Long = 1440&
Const WU_LOGPIXELSX As Long = 88&
Const WU_LOGPIXELSY As Long = 90&
Dim lngDC As Long
lngDC = GetDC(0&)
TwipsToPixels = (lngTwips / nTwipsPerInch) * CLng(GetDeviceCaps(lngDC, IIf(isXScale, WU_LOGPIXELSX, WU_LOGPIXELSY)))
lngDC = ReleaseDC(0&, lngDC)
End Function
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
CloseHandle hWndEdit
End Sub