richtextbox

how to set verticalalignment in Rich textbox

 ̄綄美尐妖づ 提交于 2019-12-13 05:59:35
问题 please teach me the way to set vertical alignment in Rich textbox i found out how to set horizen alignment in rich textbox [Sample code] richTextBox1.SelectionAlignment = HorizontalAlignment.Center but it is not vertical alignment i really wanna answer it from everyone 回答1: Flow document are designed to optimize viewing and readability. Rather than being set to one predefined layout, flow documents dynamically adjust and reflow their content based on tun-time variables such as window size,

Showing Database rtf data in richtextbox

馋奶兔 提交于 2019-12-13 05:27:04
问题 I write WPF application. In this application user copy data from the word document and add it to richtextbox. Then I save this data in sqlite database. But when I get xaml data from data base and do following procedure // Saving data StringWriter wr = new StringWriter(); XamlWriter.Save(RichTextBox.Document, wr); and FlowDocument doc = XamlReader.Parse(*wrStringValuefromDB*) as FlowDocument; End of this process richtextbox concatenate some words as follow: I can't understand what is happening

Preventing a Certain Text to be Deleted or Change in a RichTextBox

两盒软妹~` 提交于 2019-12-13 04:46:33
问题 i have RichTextBox which has a certain default text to load everytime the Form Load . this text for example: // Do not Exclude this line below i can add text in newline and delete if necessary but must not this line . like if i delete "e" in word "below" it must comeback to word "below" . same adding space or char . i started out this code in Keydown Event: Regex donotexclude = new Regex(@"//\s+\s+\s+\s+\s+\s+Do\s+not\s+exclude\s+line\s+below"); MatchCollection donotexcluDE = donotexclude

WP8: RichTextBox has no Document property

半世苍凉 提交于 2019-12-13 04:35:04
问题 So I have a RichTextBox on my xaml page in my WP8 project, set up like this: <RichTextBox x:Name="ContentDisplay" IsReadOnly="True"> </RichTextBox> I'm trying to get it to display some text. Every single piece of code I find on the net references Document property. However, when I try to do anything with it, it just isn't there. There's no var test = ContentDisplay.Document; to set to. When I try to compile the project with aforementioned line, I get a following error: 'System.Windows

Get last entered word of RichTextBox using c#

别来无恙 提交于 2019-12-13 04:34:07
问题 How do I get the last entered word and its index position( word between two spaces. as soon as I press space I need to get the word) within a RichTextBox. I have used the following code to get the last entered word and its index position if the word is in the end of the RichTextBox document. private void richTextBox_KeyPress(object sender, KeyPressEventArgs e){ if(e.KeyChar == ' '){ int i = richTextBox.Text.TrimEnd().LastIndexOf(' '); if(i != -1) MessageBox.Show(richTextBox.Text.Substring(i+1

RichTextBox Undo Adding Spaces

感情迁移 提交于 2019-12-13 04:09:55
问题 I've created my own undo system for the RichTextBox whereby whenever you do something an undo action is added to a stack, and when you press undo, this action is undone. This behavior works perfectly with all controls I've implemented it for, except for RichTextBoxes. I have reduced the system down to its simplest elements, where whenever you press delete, it adds the current selected text and its index to a stack, and when you undo this, it puts the text back at this index. Here is the code

RichEditBox: Using CTRL+I to set italic text deletes the text

牧云@^-^@ 提交于 2019-12-13 03:43:56
问题 I have the following code to bold and italicise text in a RichEditBox: private async void Page_KeyDown(object sender, KeyRoutedEventArgs e) { var state = Window.Current.CoreWindow.GetKeyState(Windows.System.VirtualKey.Control); if ((state & CoreVirtualKeyStates.Down) == CoreVirtualKeyStates.Down) { switch (e.Key) { case Windows.System.VirtualKey.B: await BoldText(); break; case Windows.System.VirtualKey.I: await ItaliciseText(); break; } } } private async Task BoldText() { ITextSelection

RichTextbox coloring behaviour

…衆ロ難τιáo~ 提交于 2019-12-13 03:36:44
问题 I am currently trying to develop an software whose behaviour is similar to Notepad++s. Regarding the 'coloring' part, I use regex and an external file containing the regex & color of each word. The file looks following: <script&blue />&blue \".*?\"&red The software then reads the file and converts it into an string array 'string[]' by splitting it at each newline character. This array is called ' Correctors '. I then use following method to find & set the color of each word matching regex

Superscript + Underline inline in a RichTextBox in WPF

无人久伴 提交于 2019-12-13 02:03:30
问题 I have a set of text that I'd like to put in a RichTextBox which goes like so: So I used a RichTextBox since it allows me to do the following. var zipCodeParagraph = new Paragraph(); string zipCodes = String.Empty; var dateRun = new Underline(new Run(DateTime.Today.DayOfWeek + ", " + CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(DateTime.Today.Month) + ' ' + DateTime.Today.Day)); Underline dateSuperscript; switch (DateTime.Today.Day % 10) { case 1: dateSuperscript = new Underline(new

How to select a word in a RichTextBox with a mouseover event

☆樱花仙子☆ 提交于 2019-12-13 01:49:42
问题 I have a long essay in a textbox. I want to copy a word in the long essay by simply move my mouse to that word and wait for 2 seconds. I do NOT want to do anything like highlight the word. May I know how to make VB do that ? Thanks 回答1: I found the following code online. (Credit goes to Siri1008) Public Function GetWordUnderMouse(ByRef Rtf As System.Windows.Forms.RichTextBox, ByVal X As Integer, ByVal Y As Integer) As String On Error Resume Next Dim POINT As System.Drawing.Point = New System