WYSIWYG Control for Winform - c#

I am looking for a free WYSIWYG editor control to be used in a Winform application. The applications primary language is VB but using C# is also an option. To clarify I need a rich text editor control that has a formatting bar. I have looked all over the web and the only options I can find are expensive control packages that have more than I need. I am not adverse to creating my own version of this control, it would just be nice to find a free and open alternative.

In this scenario, starting with CodeProject articles seems the easiest:
http://www.codeproject.com/KB/edit/editor_in_windows_forms.aspx -- Not my first recommendation, but perhaps of use if you want HTML.
http://www.codeproject.com/KB/edit/TextRulerControl.aspx?fid=968441&df=90&mpp=25&noise=3&sort=Position&view=Quick&fr=26&select=2438044
http://www.codeproject.com/KB/cs/eRichTextBox.aspx

Actually it's very easy to write your own based on the RichTextBox control.
I would go that way for sure. Your biggest problem will be the icons for the edit bar.
Check this one for starter.

Related

Rich Text Box in Xamarin.Forms

I am currently porting my application from WPF to Cross-platform. In the WPF, I used a read-only richtextbox to show the result to user in order to show both IMAGE & TEXT. In Xamarin.Forms, Is there anything similar? Thanks.
There is no control in Xamarin Forms, hence you would have to use CustomRenderers and create your own.
However I only found one decent RichTextBox implementation in
UWP RichTextBox
This means that the only way to get any decent RichTextEditor, is to use a WebView, and load a WebBased rich text editor.
But since you want it as read-only, the simplest thing to do, is to scrap the idea of any RichTextBox, and just display the text and image as separate components in your mobile app.
You can use Spans, in a label to implement formatting within the label if needed.
I found the Telerik RichTextEditor for Xamarin a much better Rich Text Editor package for Xamarin Forms after trying out and evaluating a handful of other alternatives.
This is licensed software and you have to pay for using it.
Here's the link, https://docs.telerik.com/devtools/xamarin/controls/richtexteditor/richtexteditor-overview
ScrollView can be used like readonly richtextbox. I added the elements programmatically(label for text and image). It's also read-only so it met my requirements
Syncfusion's brand-new rich text editor control for Xamarin.Forms is available now. Check out the following article for more detail.
https://www.syncfusion.com/blogs/post/introducing-xamarin-forms-rich-text-editor.aspx

Disable PowerPoint features using C#

My scenario:
I have a requirement in my project(C#).I need to give the user only reading capability for my powerpoint presentation opened thru my application.All other featues like cut,copy,paste,save,saveas,print,right click context menus should be disabled.How can i achieve this in powerpoint programatically using c#? can anyone extend their help?
Can you publish the ppt as pps and use that file instead?
Just export each slide as a JPG or PNG and display those: Slide.Export. This would be for static slide views. If you want to retain animations, transitions, video/audio and navigation features for your PPT/PPTX, a PowerPoint-to-Flash converter is a better way to do this. iSpring makes a free version of their converter: www.ispringfree.com.
You should use the Powerpoint COM component, kind of like whats described here...
Using C# to display powerpoint
I have only used Word and Excel ones, and i must say they are extremely easy to use.
Or is you MUST make it completely read-only, id suggest writing your own ODF parser, or investigating in the ODF COM component, maybe that could work as well :)
One solution could be to use something like Aspose.Slides to render the Slides to TIFF or PDF and then display those inside your application.
If you have a low number of powerpoint presentations, you can look into Information Rights Management or use the Permissions Object. (Disclaimer:I have not used this)
Assuming that you're using Powerpoint Automation. Get hold of the PowerPoint.Application object and then loop through the CommandBars property and for each command bar, set Visible to false.
This should remove the command bars at least. And there might be other properties on the Application object that lets you disable context menus, but I've never really used powerpoint, so I'm not sure which ones.
I don't think that there's any good way of disabling printing etc altogether though. However, this MS KB article discusses a hacky way of dismissing any dialogs automatically, so assuming that the print/save etc would always bring up a dialog (which I'm not sure off) you might be able to use something from there: How To Dismiss a Dialog Box Displayed by an Office Application with Visual Basic
It's all VB code in that article, but the ideas will be similar.

how i integrate html text editor in windows application?

how i integrate html text editor in windows application?
The best option would be to use a commercial syntax highlighting package, such as Actipro SyntaxEditor.
You can just use a RichTextBox and do it yourself, but it is going to be more difficult to make this seem polished. There are some articles, such as the CodeProject article, which show how to extend RichTextBox for custom editing and coloring. That would be a good starting point, if you want to make your own.
If you just want a place people can type HTML in, but don't need coloring, syntax checking, etc - you can just use a RichTextBox and let the user type in the HTML.

How to create a custom text editing control?

I need to create a text editing control in C# and I'm not sure where to start.
For a bit of context: a C# program is going to edit an XML document (using this control). The XML document can be converted to HTML.
The XML document will contain the following:
Normal text (obviously)
Headings (which will be formatted differently)
Lists
Images
Videos (they don't need to be viewed in the control, but there needs to be a box or something to indicate that they're there)
I want this control to take the XML and render it and act as an WYSIWYG editor for the XML.
For the moment, I'm not to concerned about implementing all the above details (although they will need to be implemented eventually), I just want to know where to start with creating this control. Should I be inheriting from TextBoxBase (or TextBox) and going from there? And what methods would I need to override? Or should I inherit from Control (in which case I think I'd need to all the text box stuff - selecting text, copy and paste, the caret etc. - myself, which is something I don't really want to do, but I am prepared to do if I have to).
I am aware of preexisting controls like TX Text Control that do something like what I want (although this one is far more powerful than I need), but I can't use these (this is for a university project), and besides, I really do want to know how to make this from scratch.
The topic of creating a feature rich edition control with syntax highlighting, code completion, etc. has been discussed by the developers of #develop in their book "dissecting a C# Application"
http://www.icsharpcode.net/OpenSource/SD/InsideSharpDevelop.aspx
(I think you can't buy it anymore, the link says it's available for free to download but the links seems to be broken)
The book basically explain the core features of #develop (pre V1, so it's kinda outdated), including the code editor and (what is important, too) which mistakes they made during the process.
Should I be inheriting from TextBoxBase (or TextBox) and going from there?
You can't inherit from TextBoxBase (its constructor is internal).
So you can inherit from TextBox or from Control or UserControl.
The problem with TextBox is that its painting is done by unmanaged code, which isn't overridden when you override OnPaint. For further details, see this question, answer and comments.
I am aware of preexisting controls like TX Text Control that do something like what I want
The TX Text Control is something else: it's implemented using Win32 code, with a .NET wrapper/API.
A few years ago I used the excellent open source Scintilla editor as a base to derive a custom C# control from. Worked great. Nowadays it's even easier if you leverage the ScintellaNET project (CodePlex) which has already done the wrapper work for you. Of course, if you don't mind paying, you can't go wrong with Actipro's SyntaxEditor.
Inheriting from Control will require lots of work, such as painting, implementing default behaviour, etc..
I think you can start with studying RichTextBox control because all of your requirements can be done by changing RichtextBox control.

How do I add HTML links in C# TextBox?

How can I put a link in a C# TextBox? I have tried to put HTML tags in the box but instead of showing a link it shows the entire HTML tag. Can this be done with a TextBox?
Use the RichTextBox, no need to build your own, it cames with VS
I would try using an editable div and making it look like a text box. This would allow you to get user input and use links.
To make this easier, try JEditable.
If that is in windows forms and you really can't use the richtextbox, you can create a control with a linklabel inside of textbox.
http://www.codeproject.com/KB/miscctrl/LinkTextBox.aspx
I would think about this a little bit. If you allow executable code in an editable control, the user, the user can execute ANY code. This is generally a bad idea.
The behavior of the C# control is intentional to prevent the exact behavior that you are trying to create. A little creativity (such as parsing out links from the text box and creating a list of links next or below the text box) will provide a much safer application.
To my knowledge not with the standard textbox. You'd have to create your own. One option it the Telerik controls, they're a little pricey for individual development, but very robust and configurable.
For windows application, we can use a webbrowser control. However, for web applications Freetextbox will do the job.This is freely available dll.

Categories