richtextbox

How to setcursor position in GWT RichTextArea

笑着哭i 提交于 2020-01-01 10:16:15
问题 Is there a way to set the cusror position in GWT RichTextArea. There is method setCusrorPosition() to do so in TextArea, but not in RichTextArea. Perhaps there is a native JavaScript (called from GWT) that could set the cursor position in the RichTextArea? 回答1: You are right RichTextArea is not providing the setSelectionRange method, but i have created one using the JSNI. Below is the method, public native void setSelectionRange(Element elem, int pos, int length) /*-{ try { var selection =

c# RTB - paste plain text without colours/fonts?

时光怂恿深爱的人放手 提交于 2020-01-01 01:08:10
问题 I am using Rich Text object in my C# application. The only issue I am having is that when user pastes formated text from another app, it remains formated which I cannot have. Is there any way how to paste only string and ignore formatting? Thanks! 回答1: Assuming WinForms : try this : define a RichTextBox with a KeyDown event handler like this : Append-only example : private void richTextBox1_KeyDown(object sender, KeyEventArgs e) { if (e.Control && e.KeyCode == Keys.V) { richTextBox1.Text +=

How to Display ObservableCollection<string> in a UserControl

末鹿安然 提交于 2019-12-30 11:12:43
问题 I'm new to WPF and I've found some similar questions but can't quite figure out the last part. I have a ViewModel with an ObservableCollection that contains error messages. I want to display these on the form AND allow the user to select and copy all or part of the messages. (In the past in WinForm apps I used a RichTextBox for this, but I can't figure out how to bind to one to the collection in WPF.) I got the look I was after with the following xaml, but there is no built-in way to select

How to Set inline Images Vertically Center in RichTextBox

﹥>﹥吖頭↗ 提交于 2019-12-30 07:11:41
问题 I am working on WPF, i am display RichText data in RichTextBox for that have taken WindowsFormHost, inside that i am taking WinForm RichTextBox to display RichTextData which have Images + Text. But while display that RichTextData images are align to Top and text are align to Bottom, See in Image below, red circle is RichTextImage i want to display images and Text in center. Like Below Image, the Red Circle is RichTextImage that is coming in center with text. My XAML Code is: <Window x:Class=

WPF: How to make RichTextBox look like TextBlock?

与世无争的帅哥 提交于 2019-12-30 03:00:07
问题 How can I make RichTextBox with no Margin, Border, Padding etc. ? In another words to display content in the same way as TextBlock does it ? I have tried this: <RichTextBox Margin="0" Padding="0" Grid.Row="0" BorderThickness="0" > <FlowDocument > <Paragraph>LLL</Paragraph> </FlowDocument> </RichTextBox> <TextBlock>LLL</TextBlock> But the result produces is still not what I want: There is still some space before document content (and also maybe after, on the top or bottom of the document...).

Richtextbox draw an rtf line

≡放荡痞女 提交于 2019-12-30 01:47:06
问题 I want to add a horizontal line to the RichTextBox as a delimiter of my text. I've found some examples of RTF code implementing a line and tried them in that way: rtbResFile.Rtf = @"{\rtf1{\pard some text.\par}{\pard \brdrb \brdrs \brdrw10 \brsp20 \par}{\pard \par}{\pard some other text.\par}}"; This way implements creating a blank paragraph with border, so that should looks like a line. However it doesn't show anything. Just a blank paragraph. Even if I try to implement it in the way include

C# Get cursor line in RichTextBox

梦想与她 提交于 2019-12-29 09:10:46
问题 In C#, I have a RichTextBox, and I want to get the current line of the cursor. Every answer I've found says to use: int currentLine = richTextBox1.GetLineFromCharIndex(richTextBox1.SelectionStart); However, richTextBox1.SelectionStart only updates when you make changes to the text. If you move the cursor with the arrow keys, it does not update (I've verified this by printing SelectionStart as I move around). How do I get the current line of the cursor, in a way that tracks it even if you use

C# RichTextBox Remove Custom SelectionBackColor

↘锁芯ラ 提交于 2019-12-29 07:16:47
问题 After having done some research, I believe I am asking the same question as Remove richtextbox SelectionBackColor. I have encountered the same issue, but I believe the answers in that thread were insufficient as the question was not clearly explained. Please see below: In a RichTextBox , how do I remove a custom BackColor from some, but not all, of the text ( SelectionBackColor ) so that it assumes the BackColor of the control even if that BackColor changes in the future? I have a method that

C# RichTextBox Remove Custom SelectionBackColor

烈酒焚心 提交于 2019-12-29 07:16:09
问题 After having done some research, I believe I am asking the same question as Remove richtextbox SelectionBackColor. I have encountered the same issue, but I believe the answers in that thread were insufficient as the question was not clearly explained. Please see below: In a RichTextBox , how do I remove a custom BackColor from some, but not all, of the text ( SelectionBackColor ) so that it assumes the BackColor of the control even if that BackColor changes in the future? I have a method that

Printing RichTextBox

纵然是瞬间 提交于 2019-12-29 07:13:17
问题 I am making a simple WinForms App and I wanted to allow the user to print the Text from RichTextBox. I followed MSDN link then.. And it works for a real printer (by real I mean that one I can touch:) ) But what if I want use some kind of PDF Printer? Then I must say it works when only one page is printed. Every next page is being printed on the same, first page , which means the text is being overprinted. This is obvious, but what I can do do force PDF Printer to create a new Page? This is my