wpf - RichTextBox with diagonal text lines -
i want have customized richtextbox control use in application ms word. challenge input text diagonally. used richtextbox , texteffect runs in document property of richtextbox show text diagonally , works. unfortunately caret appears in original position , direction user confused edits, types , selects. can me?
<style targettype="run"> <setter property="texteffects"> <setter.value> <texteffectcollection> <texteffect positioncount="99999"> <texteffect.transform> <transformgroup> <scaletransform/> <skewtransform/> <rotatetransform angle="30"/> <translatetransform x="30" y="0"/> </transformgroup> </texteffect.transform> </texteffect> </texteffectcollection> </setter.value> </setter> </style>
hope help
<window.resources> <style targettype="richtextbox"> <setter property="template"> <setter.value> <controltemplate targettype="{x:type textboxbase}"> <grid> <border name="border" padding="1" borderthickness="1" background="transparent" borderbrush="gray"> <scrollviewer margin="0" x:name="part_contenthost" > <scrollviewer.rendertransform> <rotatetransform angle="45"></rotatetransform> </scrollviewer.rendertransform> </scrollviewer> </border> </grid> <controltemplate.triggers> <trigger property="ismouseover" value="true"> <setter targetname="border" property="borderbrush" value="black"></setter> </trigger> <trigger property="iskeyboardfocuswithin" value="true"> <setter targetname="border" property="borderbrush" value="black"></setter> </trigger> </controltemplate.triggers> </controltemplate> </setter.value> </setter> </style> </window.resources> <grid> <richtextbox height="300" width="300"> <richtextbox.document> <flowdocument> <paragraph> <run> </run> </paragraph> </flowdocument> </richtextbox.document> </richtextbox> </grid>
update
<window.resources> <style targettype="richtextbox"> <setter property="template"> <setter.value> <controltemplate targettype="{x:type textboxbase}"> <grid> <border name="border" padding="1" borderthickness="1" background="transparent" borderbrush="gray"> <scrollviewer x:name="part_contenthost" margin="0" scrollviewer.verticalscrollbarvisibility="auto"> <scrollviewer.layouttransform> <skewtransform angley="20"/> </scrollviewer.layouttransform> </scrollviewer> </border> <textblock textwrapping="wrap"> <contentpresenter></contentpresenter> </textblock> </grid> <controltemplate.triggers> <trigger property="ismouseover" value="true"> <setter targetname="border" property="borderbrush" value="black"></setter> </trigger> <trigger property="iskeyboardfocuswithin" value="true"> <setter targetname="border" property="borderbrush" value="black"></setter> </trigger> </controltemplate.triggers> </controltemplate> </setter.value> </setter> </style> </window.resources>
you can use rotate transform also..try rotate transformation also
Comments
Post a Comment