This commit is contained in:
parent
773b2d2380
commit
989b5979a9
@ -841,6 +841,23 @@ namespace Volian.Controls.Library
|
||||
cft.dwMask |= CharFormatMasks.CFM_BACKCOLOR;
|
||||
SetCharFormat(richTextBox, selection, cft);
|
||||
}
|
||||
public static void SetSpaceBefore(RichTextBox richTextBox, int spaceBefore)
|
||||
{
|
||||
ParaFormatTwo pft = GetParaFormat(richTextBox);
|
||||
pft.dwMask = 0;
|
||||
pft.dwMask |= ParaFormatMasks.PFM_SPACEBEFORE;
|
||||
// get the monitor's resolution in DPI and use it to set the linespacing value for
|
||||
// the richtextbox. Note that without this, the Arial Unicode font made the appearance of
|
||||
// almost double linespacing. Using PFS_Exact makes it appear as regular single spacing.
|
||||
Graphics g = richTextBox.CreateGraphics();
|
||||
int dpi = Convert.ToInt32((g.DpiX + g.DpiY) / 2);
|
||||
g.Dispose();
|
||||
// dyLineSpacing is Spacing between lines. the PFS_EXACT sets line spacing as the spacing from one
|
||||
//line to the next, in twips - thus the 1440.
|
||||
|
||||
pft.dySpaceBefore = spaceBefore * 1440 / dpi;
|
||||
SetParaFormat(richTextBox, pft);
|
||||
}
|
||||
public static void SetLineSpacing(RichTextBox richTextBox, ParaSpacing type)
|
||||
{
|
||||
ParaFormatTwo pft = GetParaFormat(richTextBox);
|
||||
|
Loading…
x
Reference in New Issue
Block a user