richtextbox

Selecting text in RichTexbox in C# deletes the text

末鹿安然 提交于 2019-12-24 06:25:55
问题 I have typed in the following text in a control derived from Richtextbox "The world is {beautful}". My main intention is to create a link for the word beautful. I can create this using CFE_LINK , but that's when I select the text. When I use Select (4,9), the text within the range 4 to 9 gets deleted. Can someone please help me with what I am missing out? CODE : I am creating a User Control, derived from Richtextbox. I am giving the exact code below; I have not done any color change. I think

C# rich text box styling

两盒软妹~` 提交于 2019-12-24 05:56:34
问题 I have some strings(paragraphs) coming from DB. I need to give each of the string a separate formatting like coloring, bold and italic etc. Problem is that I am restricted to use a single Rich text box. What is the solution of my problem? Thanks 回答1: For each string you want to apply style to it, select the string and then apply the desired style. like: richTextBox1.Text = "Hi this is a string"; richTextBox1.Select(0, 2);//selects Hi richTextBox1.SelectionColor = Color.Red;//make its color

Wpf RichTextBox wrapping problems

一笑奈何 提交于 2019-12-24 05:00:13
问题 I am having a problems with text wrapping in WPF 's RichTextBox , when I get the text like: TextRange tr = new TextRange(rtb.Document.ContentStart, rtb.Document.ContentEnd); tr.Text doesnt have any "\r\n", but in visual control it looks like it should be (it wraps when input reaches RichTextBox border (inserts end of the line)). I create RichTextBox like this: <RichTextBox Name="Rtb" AcceptsReturn="True" AcceptsTab="True" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"

HTML Formatting in RichTextBox

不打扰是莪最后的温柔 提交于 2019-12-24 03:39:07
问题 I've been working with HTML strings obtained from an XML file. I'm trying to figure out a way to display these strings in a richtextbox with formatting. So e.g. <p>This is a <strong>HTML</strong> string from the <em>XML</em> file</p> or <p>This is our <span style="text-decoration: underline;">response</span></p> Should be displayed in the richtextbox like so: This is a HTML string from the XML file This is our response <<-- this should be underlined I'm not too sure how to go about with this.

Changing inline in flowdocument

*爱你&永不变心* 提交于 2019-12-24 02:47:07
问题 I have a flowdocument like this: var mcFlowDoc = new FlowDocument(); var para = new Paragraph(); para.Inlines.Add(new Run("This is the first line.")); para.Inlines.Add(new Run("This is the second line.")); para.Inlines.Add(new Run("This is the third line.")); mcFlowDoc.Blocks.Add(para); richTextBox.Document = mcFlowDoc; I need to change the background of one of the lines by clicking on any part of that text. First of all I am trying to change the background of a given inline (regardless of

Verticall scroll richtextbox on the bottom [WPF]

a 夏天 提交于 2019-12-24 02:25:07
问题 I have a richtextbox and when is full I want automatically scroll to the bottom, It is possible? Do this with xaml? 回答1: By using ScrollViewer.ScrollChanged routed event, and writing some code (for example, richTextBox1.ScrollToEnd() ), you may be able to do what you want. 回答2: RichTextBox has a ScrollToEnd method that could be called in the Codebehind. I don't know a way to do this in XAML only. 回答3: Assuming your RichTextBox is named Output , attach this method to its TextChanged event:

How to bring Inline from a RichTextBox Child into View

不羁岁月 提交于 2019-12-24 02:09:17
问题 How can i focus a Inline in a RichTextBox ? I Create a FlowDocument from a Text-File and load it in my richTextBox1 and mark one Inline after an other accordingly to a Button_click (be recreating the FlowDocument ) with this code: richTextBox1.SelectAll(); richTextBox1.Selection.Text = ""; string text = System.IO.File.ReadAllText(file); int iZeile = 0; string[] split = text.Split(new string[] {"\r\n"},StringSplitOptions.None); foreach (string s in split) { if (iZeile != 27) { paragraph

How to bring Inline from a RichTextBox Child into View

安稳与你 提交于 2019-12-24 02:09:06
问题 How can i focus a Inline in a RichTextBox ? I Create a FlowDocument from a Text-File and load it in my richTextBox1 and mark one Inline after an other accordingly to a Button_click (be recreating the FlowDocument ) with this code: richTextBox1.SelectAll(); richTextBox1.Selection.Text = ""; string text = System.IO.File.ReadAllText(file); int iZeile = 0; string[] split = text.Split(new string[] {"\r\n"},StringSplitOptions.None); foreach (string s in split) { if (iZeile != 27) { paragraph

How to save richboxtext content to .txt file via saveFiledialog?

主宰稳场 提交于 2019-12-24 01:43:16
问题 I'm trying to create a simple notepad for my self. At the moment i have created a button where i can Open file and get content. How can i create a Save file button so every line of my richboxtext goes to new .txt file? I want that i can save to a file name of my choice not a static one so i use SaveFileDialog. This is what i have for Open File. if(openFileDialog1.ShowDialog() == DialogResult.OK) { Stream plusma = openFileDialog1.OpenFile(); string faila_nosaukums = openFileDialog1.FileName;

using rich textbox in Sharepoint 2013

邮差的信 提交于 2019-12-24 01:39:12
问题 I want to use a rich textbox in Sharepoint 2013 as seen in the figure below. How can I do that? I have already used the code below. <%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <SharePoint:InputFormTextBox ID="RichTextField1" runat="server" TextMode="MultiLine" RichTextMode="FullHtml" Columns="20" Rows="10"/> but I could not get what I need. I got a simple