wpf - RichTextBox with images - problem with line spacing -
i have problem. add images (smiles) richtextbox control extended wpf toolkit.
in function on converting simple text text images set line height of paragraph , paragraph add blocks of richtextbox. here it:
private void rptexttotextwithemoticons(string msg) { //set line height var para = new paragraph {lineheight = 40}; var r = new run(msg); para.inlines.add(r); string emoticontext = getemoticontext(r.text); //if paragraph not contains smile add plain text richtextbox rtb2 if (string.isnullorempty(emoticontext)) { rtbconversation.document.blocks.add(para); } else { while (!string.isnullorempty(emoticontext)) { textpointer tp = r.contentstart; // keep moving cursor until find emoticon text while (!tp.gettextinrun(logicaldirection.forward).startswith(emoticontext)) tp = tp.getnextinsertionposition(logicaldirection.forward); // select of emoticon text var tr = new textrange(tp, tp.getpositionatoffset(emoticontext.length)) { text = string.empty }; //relative path image smile file string path = _mappings[emoticontext]; var image = new image { source = new bitmapimage(new uri(path, urikind.relativeorabsolute)), width = 30, height = 30, }; //insert smile new inlineuicontainer(image, tp); if (para != null) { var endrun = para.inlines.lastinline run; if (endrun == null) { break; } else { emoticontext = getemoticontext(endrun.text); } } } rtbconversation.document.blocks.add(para); } }
but if add new paragraphs blocks paragraphs have various line height/spacing. need constat line height/spaccing between individual paragraph, chat in skype.
my problem can see on image:
where can problem, helpless. thank advance.
just have @
Comments
Post a Comment