c# - WPF RichTextBox increment font size -
as title suggests, aim increment/decrement font size of current selection of text inside richtextbox.
this may seem trivial, , in fact - long font size same text in textrange. when selection contains text different font sizes, the
range.getpropertyvalue(textelement.fontsizeproperty); which use previous value of font size (necessary in order know set value to) returns dependencyproperty.unsetvalue .
not problem, fact there isn't method increment size, 1 explicitly set given value causing issue here.
i've considered trying parse textrange sub ranges different property values, seems convoluted way achieve should trivial.
how go this? in advance.
i think implementation, if existed, have exact same thing propose options limited:
if concern lot of operations, right , conceptual shortcut can think of apply scaletransform. of course going make appear work , isn't going change properties of selection.
if concern lot of clutter in user code, right i'd suggest hiding making own richtextbox , implementing incrementsizeofselection , decrementsizeofselection yourself.
Comments
Post a Comment