private void AddTextBox(HtmlNode node, int leftMargin = 0, int topMargin = 0, int rightMargin = 0, int bottomMargin = 0)
{
int _leftMargin = 0, _rightMargin = 0, _topMargin = 0, _bottomMargin = 0;
_currentTextBox = new RichTextBox();
if (node != null)
{
switch (node.Name.ToLower())
{
case "h1":
case "h2":
case "h3":
case "h4":
_topMargin = 20;
_bottomMargin = 10;
break;
case "p":
_bottomMargin = 20;
break;
default:
break;
}
}
if (_currentlyInBlockquote)
{
_leftMargin = 20;
_rightMargin = 20;
}
_currentTextBox.Background = Background;
_currentTextBox.FontFamily = FontFamily;
_currentTextBox.FontSize = FontSize;
_currentTextBox.FontStretch = FontStretch;
_currentTextBox.FontWeight = FontWeight;
_currentTextBox.Margin = new Thickness(leftMargin + _leftMargin,
topMargin + _topMargin,
rightMargin + _rightMargin,
bottomMargin + _bottomMargin);
_textBoxes.Add(_currentTextBox);
_itemsControl.Items.Add(_currentTextBox);
}