[size=2]
<StructLayout(LayoutKind.Sequential)> _
[size=2][color=#0000ff]Public [/color][/size][size=2][color=#0000ff]Structure[/color][/size][size=2] PARAFORMAT2
[/size][size=2][color=#0000ff] Public[/color][/size][size=2] cbSize [/size][size=2][color=#0000ff]As[/color][/size][size=2] Int32
[/size][size=2][color=#0000ff] Public[/color][/size][size=2] dwMask [/size][size=2][color=#0000ff]As[/color][/size][size=2] Int32[/size]
[size=2][color=#0000ff] Public[/color][/size][size=2] wNumbering [/size][size=2][color=#0000ff]As[/color][/size][size=2] Int16
[/size][size=2][color=#0000ff] Public[/color][/size][size=2] wReserved [/size][size=2][color=#0000ff]As[/color][/size][size=2] Int16
[/size][size=2][color=#0000ff] Public[/color][/size][size=2] dxStartIndent [/size][size=2][color=#0000ff]As[/color][/size][size=2] IntPtr
[/size][size=2][color=#0000ff] Public[/color][/size][size=2] dxRightIndent [/size][size=2][color=#0000ff]As[/color][/size][size=2] IntPtr
[/size][size=2][color=#0000ff] Public[/color][/size][size=2] dxOffset [/size][size=2][color=#0000ff]As[/color][/size][size=2] IntPtr
[/size][size=2][color=#0000ff] Public[/color][/size][size=2] wAlignment [/size][size=2][color=#0000ff]As[/color][/size][size=2] Int16
[/size][size=2][color=#0000ff] Public[/color][/size][size=2] cTabCount [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]Short
[/color][/size][size=2] <MarshalAs(UnmanagedType.ByValArray, SizeConst:=32)> _
[/size][size=2][color=#0000ff] Public[/color][/size][size=2] rgxTabs() [/size][size=2][color=#0000ff]As[/color][/size][size=2] IntPtr
[/size][size=2][color=#0000ff] Public[/color][/size][size=2] dySpaceBefore [/size][size=2][color=#0000ff]As[/color][/size][size=2] IntPtr
[/size][size=2][color=#0000ff] Public[/color][/size][size=2] dySpaceAfter [/size][size=2][color=#0000ff]As[/color][/size][size=2] IntPtr
[/size][size=2][color=#0000ff] Public[/color][/size][size=2] dyLineSpacing [/size][size=2][color=#0000ff]As[/color][/size][size=2] IntPtr
[/size][size=2][color=#0000ff] Public[/color][/size][size=2] sStyle [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]Short
[/color][/size][size=2][color=#0000ff] Public[/color][/size][size=2] bLineSpacingRule [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]Byte
[/color][/size][size=2][color=#0000ff] Public[/color][/size][size=2] bOutlineLevel [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]Byte
[/color][/size][size=2][color=#0000ff] Public[/color][/size][size=2] wShadingWeight [/size][size=2][color=#0000ff]As[/color][/size][size=2] Int16
[/size][size=2][color=#0000ff] Public[/color][/size][size=2] wShadingStyle [/size][size=2][color=#0000ff]As[/color][/size][size=2] Int16
[/size][size=2][color=#0000ff] Public[/color][/size][size=2] wNumberingStart [/size][size=2][color=#0000ff]As[/color][/size][size=2] Int16
[/size][size=2][color=#0000ff] Public[/color][/size][size=2] wNumberingStyle [/size][size=2][color=#0000ff]As[/color][/size][size=2] Int16
[/size][size=2][color=#0000ff] Public[/color][/size][size=2] wNumberingTab [/size][size=2][color=#0000ff]As[/color][/size][size=2] Int16
[/size][size=2][color=#0000ff] Public[/color][/size][size=2] wBorderSpace [/size][size=2][color=#0000ff]As[/color][/size][size=2] Int16
[/size][size=2][color=#0000ff] Public[/color][/size][size=2] wBorderWidth [/size][size=2][color=#0000ff]As[/color][/size][size=2] Int16
[/size][size=2][color=#0000ff] Public[/color][/size][size=2] wBorders [/size][size=2][color=#0000ff]As[/color][/size][size=2] Int16
[/size][size=2][color=#0000ff]End [/color][/size][size=2][color=#0000ff]Structure[/color][/size]
[size=2][color=#0000ff]
[/color][/size][size=2]<DllImport("user32", CharSet:=CharSet.Auto)> _
[/size][size=2][color=#0000ff]Private [/color][/size][size=2][color=#0000ff]Shared [/color][/size][size=2][color=#0000ff]Function[/color][/size][size=2] SendMessage( _
[/size][size=2][color=#0000ff] ByVal[/color][/size][size=2] hWnd [/size][size=2][color=#0000ff]As[/color][/size][size=2] HandleRef, _
[/size][size=2][color=#0000ff] ByVal[/color][/size][size=2] msg [/size][size=2][color=#0000ff]As[/color][/size][size=2] Int32, _
[/size][size=2][color=#0000ff] ByVal[/color][/size][size=2] wParam [/size][size=2][color=#0000ff]As[/color][/size][size=2] Int32, _
[/size][size=2][color=#0000ff] ByVal[/color][/size][size=2] lParam [/size][size=2][color=#0000ff]As[/color][/size][size=2] Int32) [/size][size=2][color=#0000ff]As[/color][/size][size=2] Int32
[/size][size=2][color=#0000ff]End [/color][/size][size=2][color=#0000ff]Function
[/color][/size][size=2]<DllImport("user32", CharSet:=CharSet.Auto)> _
[/size][size=2][color=#0000ff]Private [/color][/size][size=2][color=#0000ff]Shared [/color][/size][size=2][color=#0000ff]Function[/color][/size][size=2] SendMessage( _
[/size][size=2][color=#0000ff] ByVal[/color][/size][size=2] hWnd [/size][size=2][color=#0000ff]As[/color][/size][size=2] HandleRef, _
[/size][size=2][color=#0000ff] ByVal[/color][/size][size=2] msg [/size][size=2][color=#0000ff]As[/color][/size][size=2] Int32, _
[/size][size=2][color=#0000ff] ByVal[/color][/size][size=2] wParam [/size][size=2][color=#0000ff]As[/color][/size][size=2] Int32, _
[/size][size=2][color=#0000ff] ByRef[/color][/size][size=2] lParam [/size][size=2][color=#0000ff]As[/color][/size][size=2] PARAFORMAT2) [/size][size=2][color=#0000ff]As[/color][/size][size=2] Int32
[/size][size=2][color=#0000ff]End [/color][/size][size=2][color=#0000ff]Function
[/color][/size][size=2][color=#0000ff]Private [/color][/size][size=2][color=#0000ff]Const[/color][/size][size=2] EM_GETPARAFORMAT = 1085
[/size][size=2][color=#0000ff]Private [/color][/size][size=2][color=#0000ff]Const[/color][/size][size=2] EM_SETPARAFORMAT = 1095
[/size][size=2][color=#0000ff]Private [/color][/size][size=2][color=#0000ff]Const[/color][/size][size=2] PFM_NUMBERING [/size][size=2][color=#0000ff]As[/color][/size][size=2] Int32 = &H20
[/size][size=2][color=#0000ff]Private [/color][/size][size=2][color=#0000ff]Const[/color][/size][size=2] BULLET_NUMBER = 2[/size]
[size=2] [/size]
[size=2]
[/size][size=2][color=#0000ff]Private [/color][/size][size=2][color=#0000ff]Sub[/color][/size][size=2] Button1_Click([/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] sender [/size][size=2][color=#0000ff]As[/color][/size][size=2] System.Object, [/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] e [/size][size=2][color=#0000ff]As[/color][/size][size=2] System.EventArgs) [/size][size=2][color=#0000ff]Handles[/color][/size][size=2] Button1.Click[/size]
[size=2]
[/size][size=2][color=#0000ff] Dim[/color][/size][size=2] param [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]New[/color][/size][size=2] PARAFORMAT2[/size]
[size=2]
[/size][size=2][color=#008000] '/// you must specify the size of the structure here, using Marshal.SizeOf , in VB6 it was Len( )[/color][/size]
[size=2][color=#008000]
[/color][/size][size=2] [color=black]param.cbSize = Marshal.SizeOf(param)[/color][/size]
[size=2]
[/size][size=2][color=#008000] '/// build up the param structure with the current layout...[/color][/size]
[size=2][color=#008000]
[/color][/size][size=2] [color=black]SendMessage([/color][/size][size=2][color=#0000ff]New[/color][/size][size=2] [color=black]HandleRef(rtb, rtb.Handle), EM_GETPARAFORMAT, 0, param)[/color][/size]
[size=2]
[/size][size=2][color=#008000] '/// wNumbering[/color][/size]
[size=2][color=#008000]
[/color][/size][size=2][color=#008000] '/// Options used for bulleted or numbered paragraphs. To use this member, set the PFM_NUMBERING flag in the dwMask member.[/color][/size]
[size=2][color=#008000]
[/color][/size][size=2][color=#008000] '/// PFN_BULLET ( 1 ) = Insert a bullet at the beginning of each selected paragraph[/color][/size]
[size=2][color=#008000]
[/color][/size][size=2][color=#008000] '/// 2 = Uses Arabic numbers (1, 2, 3, ...). , hence BULLET_NUMBER.[/color][/size]
[size=2][color=#008000]
[/color][/size][size=2] [color=black]param.dwMask = PFM_NUMBERING[/color]
[color=black]param.wNumbering = BULLET_NUMBER[/color]
[/size][size=2][color=#008000] '/// update the richtextbox...
[/color][/size][size=2] [/size]
[size=2] [color=black]SendMessage([/color][/size][size=2][color=#0000ff]New[/color][/size][size=2] [color=black]HandleRef(rtb, rtb.Handle), EM_SETPARAFORMAT, 0, param)[/color][/size]
[size=2]
[/size][size=2][color=#0000ff]End [/color][/size][size=2][color=#0000ff]Sub[/color][/size]
[/size][size=2][color=#0000ff]
[/color][/size]