Highlights
All Snippets
Top 100 Snippets
Librarians
gbCodeLib

By Language
VB6
JavaScript
Perl
HTML
SQL
Java
DOS

GBIC >> Source Code >> Visual Basic >> Snippet

Wordwrap


'1. one approach

Sub  WordWrap()
'word wrap is on when the margin Is arbitrarily very large
If mnuWordWrap.Checked = True Then
    'on
   txtIn.RightMargin = txtIn.Width - 25
Else
    'off
   txtIn.RightMargin = 1001 * frmChat.TextWidth( "a" )
End If
End Sub

'============================
'2. another approach

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
                       ( ByVal hwnd As Long , ByVal wMsg As Long , _
                        ByVal wParam As Long , lParam As Any) As Long
Const WM_USER = &H400
Const EM_SETTARGETDEVICE = (WM_USER + 72)

'wordwrap
SendMessageLong frmMain.rtfTest, EM_SETTARGETDEVICE, 0, 0

'default
SendMessageLong frmMain.rtfTest, EM_SETTARGETDEVICE, 0, 1