Set the RichTextbox to automatic wrap or non-automatic wrap

zhaozj2021-02-16  46

Recently research text controls and strings, studying heads and brain, the problem is too much. This is only one of the problems, the answer comes from the expert website and 9CBS Technofantasy (www.applevb.com), solve the following: public const wm_user = & h400public const EM_SETTARGETDEVICE = (WM_USER 72) Public Declare Function Getdc lib "user32" (ByVal hWnd As Long) As LongPublic Declare Function SendMessage Lib "user32" Alias ​​"SendMessageA" _ (ByVal hWnd As Long, _ ByVal wMsg As Long, _ ByVal wParam As Long, _ lParam As Any) As LongPublic Sub AutoSwitchLine (ByRef RichText As Long , ByVal bSwitch As Boolean) If bSwitch Then 'provided RichTextBox wrap Call SendMessage (RichText.hWnd, EM_SETTARGETDEVICE, _ GetDC (RichText.hWnd), RichText.Width / 15) If RichText.RightMargin = 0 Then RichText.RightMargin = 1 Else Richtext.rightmargin = 0 END IF ELSE 'Setting RichtextBox does not automatically wrap Call sendMessage (Richtext.hwnd, EM_SETTARGETDEVICE, 0, 1) end ifend sub

转载请注明原文地址:https://www.9cbs.com/read-27608.html

New Post(0)