richtextbox

C#: Drag and Drop in WPF (Richtextbox)

不想你离开。 提交于 2019-12-06 05:07:41
i want to implement a Drag/Drop mechanic in WPF, but it didn't work... With Windows-Forms it worked, ... First i set AllowDrop to True. In windows-forms you can already drag items into the richtextbox and the cursor changes. With WPF .... nothing happens. The nexT point: Implement DragEnter and DragDrop Methodes. I did it like the online-manuals says. (ok i had to try out something more, because DragDrop doesn't exists in WPF) I think all tutorials for drag/drop is only for Windowsforms, nothing for WPF... Is there a problem with the richtextbox? If i change it to "allowDrop" - nothing happens

Insert an image into RTF document in C#

拈花ヽ惹草 提交于 2019-12-06 04:44:51
问题 I am creating a RichTextBox subclass that can insert images easily. I referred to this question to start, but I can't get the generated RTF string to work. When I try to set the SelectedRtf of the RTB, it errors out with "File format is not valid." Here is my code: internal void InsertImage(Image img) { string str = @"{\pict\pngblip\picw24\pich24 " + imageToHex(img) + "}"; this.SelectedRtf = str; // This line throws the exception } private string imageToHex(Image img) { MemoryStream ms = new

TinyMCE: Using CSS class attributes with the formatselect-dropdown formats

守給你的承諾、 提交于 2019-12-06 03:43:08
I would like to customize the formats in the TinyMCE formatselect dropdown to support css class attributes. Example: If would like to be able to select <h2 class='foo'> instead of just <h2> as format in the formatselect dropdown. Does anyone here have an idea how I could do this? There is no smart way to do this in the current TinyMCE version according to its main developer : We have plans for a advanced style format plugin. So that you can specify formats, styles, containers, wrappers etc in a JSON style structure. Best regards, Spocke - Main developer of TinyMCE ...though there is an

Extended WPF Toolkit RichTextBox display text vertically

馋奶兔 提交于 2019-12-06 03:03:15
I'm trying to bind a rich content (RTF format) to a rich text box (of Extended WPF Toolkit) via its Text property like this <extToolkit:RichTextBox x:Name="rtbKIContent" Margin="8,8,8,8" IsEnabled="{Binding IsEditable}" Text="{Binding Content}"> <extToolkit:RichTextBox.TextFormatter> <extToolkit:RtfFormatter></extToolkit:RtfFormatter> </extToolkit:RichTextBox.TextFormatter> <extToolkit:RichTextBoxFormatBarManager.FormatBar> <extToolkit:RichTextBoxFormatBar /> </extToolkit:RichTextBoxFormatBarManager.FormatBar> </extToolkit:RichTextBox> Sometimes it works just fine, but there are circumstances

Strange shift when Selecting text in richtext box v5 that contains hyperlinks

冷暖自知 提交于 2019-12-06 02:32:43
问题 When I use the RichTextBox.Select(int start, int length) function to select text in a rich text box that contains hyperlinks, there is some shift in the selection when I try to select any text that is after the hyperlink. When I remove the hyperlink, the selection works properly. Edit: I use RichTextBox 5 (the default in Visual Studio is version 4) public class RichText50W : RichTextBox { [DllImport("kernel32.dll", CharSet = CharSet.Auto)] static extern IntPtr LoadLibrary(string lpFileName);

How can I create subclass of class Inline ? (the one used in FlowDocument)

天涯浪子 提交于 2019-12-06 01:59:28
问题 In WPF I would like to create custom Inline implementation. From documentation of Inline: "An abstract class that provides a base for all inline flow content elements." Classes like Figure, Run or Span inherit from Inline. My custom class inheriting from Inline would be something like '2 lined Run'. I have special needs for flow of document and this seems to be the only way. However I don't know where to start: Inline does not define any members! It is abstract class so it is meant to be

Font size mismatch between RichTextBox and Word

放肆的年华 提交于 2019-12-06 01:27:27
问题 I have a small WPF application that hosts a RichTextBox: <RichTextBox SpellCheck.IsEnabled="True" FontFamily="Verdana" AcceptsTab="True" AcceptsReturn="True" FontSize="14" /> As shown the code snippet above, I set the font size to 14. If I copy text from this RichTextBox to Microsoft Word or Microsoft WordPad, the font size is reported to be 10.5. Similar oddities persist if I paste text from Word or WordPad. I have verified that the text being selected from my app is sized at 14. Any help

contentEditable cursor position/style in FireFox

久未见 提交于 2019-12-06 01:11:05
问题 I'm having trouble using contentEditable in FireFox 3. I have a problem where the cursor will appear above or only partially in the div after I click in it (until I start typing at which time it behaves correctly). Any ideas on how I can stop this from happening? HTML: <html> <head><title>Test Page</title></head> <body> <div id="editor" style="position:absolute; left:157px; top:230px; width:120px; height:30px"> <div id="input" style="width:100%; height:100%; border:1px solid black; outline

C# Preventing RichTextBox from scrolling/jumping to top

≡放荡痞女 提交于 2019-12-05 20:51:49
It appears that when using a System.Windows.Forms.RichTextBox you can use textbox.AppendText() or textbox.Text = "" for adding text to the textbox. AppendText will scroll to the bottom and adding the text directly will not scroll, but will jump to the top when the user has the textbox focused. Here is my function: // Function to add a line to the textbox that gets called each time I want to add something // console = textbox public void addLine(String line) { // Invoking since this function gets accessed by another thread console.Invoke((MethodInvoker)delegate { // Check if user wants the

KeyBinding gesture “Ctrl+1” in RichTextBox doesn't work

三世轮回 提交于 2019-12-05 20:16:46
There is a strange difference when binding commands to Ctrl+N gestures in WPF. Some but not all of these gestures are ignored, while the rest are ok. Did anyone else experience this behavior by any chance? Window XAML structure is very simple: command binding, input binding, and a DockPanel with Menu and RichTextBox. After testing, the problem appears only when input focus is in RichTextBox. For the test, Window input binding was defined for all numeric keys as shown below. As a result, Ctrl+1 , Ctrl+2 , and Ctrl+5 wouldn't do anything, while Ctrl+3 , 4 , 6-9 , and 0 are working just fine. Alt