Option Explicit
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
Private Const WM_USER& = &H400
Private Const EM_GETPARAFORMAT = (WM_USER + 61)
Private Const EM_SETPARAFORMAT = (WM_USER + 71)
Private Const MAX_TAB_STOPS = 32&
Private Const PFM_LINESPACING = &H100&
Private Type PARAFORMAT2
cbSize As Integer
wPad1 As Integer
dwMask As Long
wNumbering As Integer
wEffects As Integer
dxStartIndent As Long
dxRightIndent As Long
dxOffset As Long
wAlignment As Integer
cTabCount As Integer
lTabStops(0 To MAX_TAB_STOPS - 1) As Long
' PARAFORMAT2
dySpaceBefore As Long
dySpaceAfter As Long
dyLineSpacing As Long
sStyle As Integer
bLineSpacingRule As Byte
bOutlineLevel As Byte
wShadingWeight As Integer
wShadingStyle As Integer
wNumberingStart As Integer
wNumberingStyle As Integer
wNumberingTab As Integer
wBorderSpace As Integer
wBorderWidth As Integer
wBorders As Integer
End Type
Private Sub Command1_Click()
Dim PF2 As PARAFORMAT2
With PF2
.cbSize = LenB(PF2)
.dwMask = PFM_LINESPACING
.bLineSpacingRule = 4
.dyLineSpacing = 100 * Screen.TwipsPerPixelY
End With
Dim i As Long
i = SendMessage(RichTextBox1.hwnd, EM_SETPARAFORMAT, 0, PF2)
End Sub
Option Explicit
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
Private Const WM_USER& = &H400
Private Const EM_GETPARAFORMAT = (WM_USER + 61)
Private Const EM_SETPARAFORMAT = (WM_USER + 71)
Private Const MAX_TAB_STOPS = 32&
Private Const PFM_LINESPACING = &H100&
Private Type PARAFORMAT2
cbSize As Integer
wPad1 As Integer
dwMask As Long
wNumbering As Integer
wEffects As Integer
dxStartIndent As Long
dxRightIndent As Long
dxOffset As Long
wAlignment As Integer
cTabCount As Integer
lTabStops(0 To MAX_TAB_STOPS - 1) As Long
' PARAFORMAT2
dySpaceBefore As Long
dySpaceAfter As Long
dyLineSpacing As Long
sStyle As Integer
bLineSpacingRule As Byte
bOutlineLevel As Byte
wShadingWeight As Integer
wShadingStyle As Integer
wNumberingStart As Integer
wNumberingStyle As Integer
wNumberingTab As Integer
wBorderSpace As Integer
wBorderWidth As Integer
wBorders As Integer
End Type
Private Sub Command1_Click()
Dim PF2 As PARAFORMAT2
With PF2
.cbSize = LenB(PF2)
.dwMask = PFM_LINESPACING
.bLineSpacingRule = 4
.dyLineSpacing = 100 * Screen.TwipsPerPixelY
End With
Dim i As Long
i = SendMessage(RichTextBox1.hwnd, EM_SETPARAFORMAT, 0, PF2)
End Sub
IViewObjectEx::GetRect
Returns a rectangle describing a requested drawing aspect.
HRESULT GetRect(
DWORD dwAspect, //Requested drawing aspect
LPRECTL pRect //Pointer to the rectangle
);
Parameters
dwAspect
[in] Drawing aspect requested.
pRect
[out] Pointer to the rectangle describing the requested drawing aspect.
Return Values
S_OK
The rectangle was successfully returned.
DV_E_DVASPECT
The method does not support the specified aspect. Either the object does not support the aspect requested or the aspect is not rectangular.
Remarks
This method returns a rectangle describing the specified drawing aspect. The returned rectangle is in HIMETRIC units, relative to the object's origin. The rectangle returned depends on the drawing aspect as follows:
DVASPECT_CONTENT
Objects should return the bounding rectangle of the whole object. The top-left corner is at the object's origin and the size is equal to the extent returned by IViewObject2::GetExtent.
DVASPECT_OPAQUE
Objects with a rectangular opaque region should return that rectangle. Others should fail and return error code DV_E_DVASPECT.
If a rectangle is returned, it is guaranteed to be completely obscured by calling IViewObject::Draw for that aspect. The container should use that rectangle to clip out the object's opaque parts before drawing any object behind it during the back to front pass. If this method fails on an object with a non-rectangular opaque region, the container should draw the entire object in the back to front part using the DVASPECT_CONTENT aspect.
DVASPECT_TRANSPARENT
Objects should return the rectangle covering all transparent or irregular parts. If the object does not have any transparent or irregular parts, it may return DV_E_ASPECT. A container may use this rectangle to determine whether there are other objects overlapping the transparent parts of a given object.