private void UpdateVisualTextFormatting(Settings.DifferencesFormatting differencesFormatting, RichTextBox richTextBox, string text, int selectionStart, int selectionLength) { richTextBox.Text = text; var isBold = string.Compare(differencesFormatting.StyleBold, "Activate", StringComparison.OrdinalIgnoreCase) == 0; var isItalic = string.Compare(differencesFormatting.StyleItalic, "Activate", StringComparison.OrdinalIgnoreCase) == 0; var isStrikethrough = string.Compare(differencesFormatting.StyleStrikethrough, "Activate", StringComparison.OrdinalIgnoreCase) == 0; var isUnderline = string.Compare(differencesFormatting.StyleUnderline, "Activate", StringComparison.OrdinalIgnoreCase) == 0; var strPosition = differencesFormatting.TextPosition; var fontStyleNew = GetFontStyle(isBold, isItalic, isStrikethrough, isUnderline); richTextBox.Select(selectionStart, selectionLength); richTextBox.SelectionFont = new Font(richTextBox.Font.Name, richTextBox.Font.Size, fontStyleNew); if (differencesFormatting.FontSpecifyColor) { richTextBox.SelectionColor = ColorTranslator.FromHtml(differencesFormatting.FontColor); } else { richTextBox.SelectionColor = richTextBox.ForeColor; } if (differencesFormatting.FontSpecifyBackroundColor) { richTextBox.SelectionBackColor = ColorTranslator.FromHtml(differencesFormatting.FontBackroundColor); } else { richTextBox.SelectionBackColor = richTextBox.BackColor; } switch (strPosition) { case "Normal": richTextBox.SelectionCharOffset = 0; break; case "Superscript": richTextBox.SelectionCharOffset = 5; break; case "Subscript": richTextBox.SelectionCharOffset = -5; break; } }
public void SetDefaultToDefaults() { #region | general settings | comboBox_comparisonType.SelectedItem = "words"; checkBox_includeTagsInComparison.Checked = true; #endregion #region | report filter settings | checkBox_reportFilterChangedTargetContent.Checked = true; checkBox_reportFilterSegmentStatusChanged.Checked = false; checkBox_reportFilterSegmentsContainingComments.Checked = true; #endregion #region | new text style | StyleNewText = new Settings.DifferencesFormatting { StyleBold = "Deactivate", StyleItalic = "Deactivate", StyleStrikethrough = "Deactivate", StyleUnderline = "Activate", TextPosition = "Normal", FontSpecifyColor = true, FontColor = "#0000FF", FontSpecifyBackroundColor = true, FontBackroundColor = "#FFFF66" }; #endregion #region | removed text style | StyleRemovedText = new Settings.DifferencesFormatting { StyleBold = "Deactivate", StyleItalic = "Deactivate", StyleStrikethrough = "Activate", StyleUnderline = "Deactivate", TextPosition = "Normal", FontSpecifyColor = true, FontColor = "#FF0000", FontSpecifyBackroundColor = false, FontBackroundColor = "#FFFFFF" }; #endregion #region | new tag style | StyleNewTag = new Settings.DifferencesFormatting { StyleBold = "Deactivate", StyleItalic = "Deactivate", StyleStrikethrough = "Deactivate", StyleUnderline = "Deactivate", TextPosition = "Normal", FontSpecifyColor = false, FontColor = "#000000", FontSpecifyBackroundColor = true, FontBackroundColor = "#DDEEFF" }; #endregion #region | removed tag style | StyleRemovedTag = new Settings.DifferencesFormatting { StyleBold = "Deactivate", StyleItalic = "Deactivate", StyleStrikethrough = "Deactivate", StyleUnderline = "Deactivate", TextPosition = "Normal", FontSpecifyColor = false, FontColor = "#000000", FontSpecifyBackroundColor = true, FontBackroundColor = "#FFE8E8" }; #endregion #region | custom style sheet | checkBox_useCustomStyleSheet.Checked = false; #endregion UpdateVisualStyle(); }