Borders and Background of Paragraphs
|Top Previous Next|
Paragraphs can have borders and/or background color. These properties are defined in paragraph attributes ("styles") (see TParaInfo). Border is defined in Border property, background is in Background property.
By default, there is no border around paragraph (TRVStyle.ParaStyles[i].Border.Style=rvbsNone), and background of paragraph is transparent (TRVStyle.ParaStyles[i].Background.Color=clNone).
Border offsets and colored area offsets are defined separately from each other, so you can draw border inside colored area, border around colored area with gap, and even more interesting effects:
Example of paragraph border and background
Border and colored area both have BorderOffsets property, which defines:
▪for borders: a gap between the border and the paragraph contents;
▪for background: a colored area overhang (padding) from the paragraph content.
Top, right, bottom, left offsets (i.e. gap and padding) are defined by Top, Right, Bottom, Left properties of BorderOffsets.
Positive values increase gap (padding). Negative values put the border and edges of the colored area inside the paragraph content.
In the example above, Background.BorderOffsets = (Left: -7; Top: -7; Right: 7; Bottom: 7), and values are measured in pixels.
BorderOffsets.Top must not exceed SpaceBefore property of the same paragraph.
BorderOffsets.Bottom must not exceed SpaceAfter property of the same paragraph.
Scheme: properties of paragraph border, background and layout
You can hide some edges of border using Border.VisibleBorders property.
Breaks use SpaceBefore and SpaceAfter values of the 0-th paragraph style, but they never have a border and a colored background.
It's possible to create a line break without starting a new paragraph. In editor, press Shift + Enter instead of Enter . Items after the caret will be moved to the new line, but still they will be inside the same paragraph (inside the common border and the colored area, no SpaceBefore and SpaceAfter will be applied).
TRichView © trichview.com