Public Class PropertyValues Public Property propVal1 As Object Public Property propVal2 As Object Public Property propVal3 As Object Public Property propVal4 As Object Public Property propVal5 As Object Public Property propVal6 As Object Public Property propVal7 As Object Public Property propInline As Object Public Function SavePropertyValues(ByVal ActiveTBox As RichTextBox, ByVal selection As TextRange) As TextRange propInline = selection.GetPropertyValue(Inline.TextDecorationsProperty) propVal1 = selection.GetPropertyValue(TextElement.FontWeightProperty) propVal2 = selection.GetPropertyValue(TextElement.FontStyleProperty) propVal3 = selection.GetPropertyValue(TextElement.FontFamilyProperty) propVal4 = selection.GetPropertyValue(TextElement.FontSizeProperty) propVal5 = selection.GetPropertyValue(TextElement.FontStretchProperty) propVal6 = selection.GetPropertyValue(TextElement.ForegroundProperty) propVal7 = selection.GetPropertyValue(TextElement.BackgroundProperty) If propInline.Equals(TextDecorations.Underline) Then MessageBox.Show("prop 38 underline") If propInline.Equals(TextDecorations.Strikethrough) = True Then MessageBox.Show("strike through !") Return selection End Function Public Function RestorePropertyValues(ByVal ActiveTBox As RichTextBox, ByVal selection As TextRange) As TextRange If propInline.Equals(TextDecorations.Underline) = True Then MessageBox.Show("prop 52 underline !") End If selection.ApplyPropertyValue(Inline.TextDecorationsProperty, propInline) selection.ApplyPropertyValue(TextElement.FontWeightProperty, propVal1) selection.ApplyPropertyValue(TextElement.FontStyleProperty, propVal2) selection.ApplyPropertyValue(TextElement.FontFamilyProperty, propVal3) selection.ApplyPropertyValue(TextElement.FontSizeProperty, propVal4) selection.ApplyPropertyValue(TextElement.FontStretchProperty, propVal5) selection.ApplyPropertyValue(TextElement.ForegroundProperty, propVal6) selection.ApplyPropertyValue(TextElement.BackgroundProperty, propVal7) Return selection End Function End Class
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)