I have been extending the RichTextBox control in VS2008 using C# (adding printer support and URL links). I have most of the functionality I need but the control is not that good. I do not know how to change the mouse cursor for image sizing handles. Bullets get out of wack with the size and colour. I need this for winforms not asp.net or wpf. I prefer rtf to html wysiwyg editors.
Most of the richtextbox replacements are either too old .NET 1.0/1.1, too simple or way too complex and expensive.
I am using Infragistics control libraries and their closest control to the richtextbox does not quite provide all the functionality I want. They do supply a spell checking control which works with both their text based controls and std winforms textbox and richtextbox. It will work with any control that implements the IProvideTextBox or ISupportSpellChecking interfaces. Unfortunately most of the functionally richtextbox replacements provide their own spelling checking addon controls which do not support either IProvideTextBox or ISupportSpellChecking. I want to distibute 1 std dictionary to users with my application not multiple one which need to be kept some how in synch.
The other thing is the richtextbox just comes as an unadorned control. You need to add your own menu controls and wire things up yourself. Most of the expensive replacments provide a tool bar ready wired up. This is nice but if one is developing a consistant look and feel to all ones applications having to drop a vendors tool bar makes this difficult as one now has this odd set of menu buttons that look and behave differently to the rest of my UI. Also I am using an application styler to skin my aplications. Third party menu controls are unlikely to accomodate this sort of styling.
Can anyone suggest a reasonable RichTextBox control replace that I could use that won't cost the earth, works in winforms, supports RTF and is robust with proper mouse over transitions for image sizing handles and with reliable bullet support.
My current option is scale back my efforts and remove support for the features that just don't cut it but will still leave me with something that is usable.
We use the DevExpress Rich Text Editor here are we are very satisfied. The price is not high and the support is incredible.
The editor is also embeddable inside their grid, should you want to buy the whole package.
By adorner, do you mean like the Office 2007 toolbar that pop out over a selected text?
While I don't have extensive experience with RichTextBoxes, I have had great success with the DevExpress control suite in the past (much, much nicer than Infragistics, IMHO). I also know that they released a brand new RTF editor in the past few months, so I would definitely give that a look.
You could always try the Microsoft Inkedit Control provided you've got an OS that supports it (I had issues with 64bit WS2008, and Windows XP, but the rest were fine).
InkEdit inherits from RichTextBox so you can:
private System.Windows.Forms.RichTextBox richTextBox3;
try
{
this.richTextBox3 = new Microsoft.Ink.InkEdit();
Microsoft.Ink.InkEdit ie = (Microsoft.Ink.InkEdit)richTextBox3;
// disable tablet-style ink mode
ie.InkMode = Microsoft.Ink.InkMode.Disabled;
}
catch
{
\\ in case platform does not support inkedit control
this.richTextBox3 = new RichTextBox();
}
You will need to add a reference to the Microsoft.Ink.dll which (on my machine) is at:
C:\Program Files\Reference Assemblies\Microsoft\Tablet PC
Unless you want to use this controls ink features, then there probably aren't major benefits in terms as features. But, I have noticed that loading text is much faster for long files (10x +) than the previous RichTextBox and also seems to have smoother scrolling.
This seems to be unadvertised, but Visual Studio 2010 B1 has an updated RichTextBox control also.
I'm using the ScintillaNet, but it also in some way (very) complex.
Related
May be i can get some negative points on this question but, really this question is boggling in my mind from last many days that what is the basic/raw code behind textbox(or other such controls).
i mean i understands that, we can inherit the textbox class and make our changes, we creates its object and use it.
but wants to know how that class creates a textbox(the design which allow us to enter text) (same query for other components), is it a code of 'C' language which are generating it using CG (computer graphics) programming or any other thing.
Experts please resolve my curiosity.
Thanks
Windows provides several basic API's for drawing on the screen. You can draw pixels, lines, boxes and more complex geometric shapes. There are also API's to draw text. Other API's allow you to react to user input, e.g. mouse movement and clicks and keyboard input.
From these basic API's you can create your own text box by drawing the exact pixels of how the text box should look and react to user input. However, Windows has a built-in concept of a text box. This text box has a standard look and feel and is also integrated with UI concepts like focus, tab order, the clipboard and the caret. But behind the scenes Windows is using the low level API functions to draw on the screen and react to user input.
When you create a TextBox in Windows Forms it actually creates and wraps a standard Windows Edit control. This control is drawn using GDI. However, other programming models like WPF may create TextBox controls that looks like a normal text box but uses a custom implementation supplied by WPF and is drawn using DirectX.
Use http://www.red-gate.com/products/reflector/ and see for yourself...
Here is what I think it is doing:
The Raw code behind TextBox or any other Control uses Windows API that is responsible for drawing these controls and provide Handles of these controls for later reference.
Windows has been using different methods to draw it's UI like GDI, GDI+ and sometimes DirectX. I may be wrong and there may be some other techs I forgot to mention.
These controls use each window's WinProc to receive Input Notification and other callbacks that notify these controls when clicked, typed or for example resized.
I was wondering is there any option of using Stylesheets for .NET Windows controls ?
If not, which is the best way to make the UI look consistent.I need to use VS 2005 to make
the changes in the UI.
Regards
We derive usercontrols from all controls in our system -- all the derived classes do is set the style from a central list of constants defining colours and fonts. Then we use these controls on our WinForms for a consistent look and feel.
If we want to change the style, we just change the list of constants.
This also allows is to perform UI tricks like setting the background colour of controls to a different colour when they are being edited.
If you want to make your UI consistent and pretty, why don't you give WPF a try? You will be able to organize your styles in resource dictionary, then reference to it in all the other projects.
Well guess he's talking about WinForms. Then you cant use Stylesheets. Havnt coded that much of WinForms. But guess you could have an "Settings/sheet" class that have properties of different style you are using and then set them when creating your controls.
you can use Stylesheets in web pages only not in Windows controls.
Even ASP.NET controls, which ultimately render HTML, are notoriously CSS-unfriendly. The reason is that they use tables extensively for layout, and they set a lot of inline style tags which of course do not honor the style sheet. Some work has been done to create wrappers for these controls, but it was incomplete the last I looked.
It's a shame, but our team will not use the out-of-the box controls most of the time. We've rolled our own and packaged them into an internal library. While the Microsoft controls would have been very useful, they simply don't meet our criteria for clean, accessible, styleable HTML.
Microsoft seems, finally, after something like 10 years, to have realized that this is important to a modern development team. The control output of ASP.NET MVC is far cleaner and behaves itself quite well with respect to CSS. Whether they'll eventually revisit the core ASP.NET controls is anyone's guess.
I created a TabControl using Windows Forms but the tab headers look very ugly. I want to make them with rounded corners and also create some space between two tab headers. Can anyone please tell how it can be done using C#.
Thanks,
gary
You'll want to do one of a few things:
Make your own custom control that inherits from TabControl and overrides its render method.
Download a third-party custom tab control that does what you want.
Switch to WPF, which gives you some more flexibility in the way of creating and styling controls.
There isn't a way to do this with System.Windows.Forms.TabControl out of the box, so you'll have to either live with what you've got, or roll your own.
Not to spark any heated debate, but WinForms is an aging API. If you're building a brand new application and/or learning a UI framework for the first time, you might consider using WPF instead. For legacy code, it's fine to maintain WinForms of course.
The System.Windows.Forms.TabControl class is just a wrapper around the Windows COMCTL32 tab control. Unfortunately, that control doesn't provide much in the way of customization options. You'll have to switch controls, either to WPF, custom code, or some third-party product.
I'm working on an application, and I have a screen that in my mind, looks a lot like the Wireless Network List in Windows Vista. For those who are unaware, its basically a listview, but in each row, instead of a line of text, there's a large 'panel' that contains all sorts of useful information. Does anyone know if that's an actual UI control available on windows, or should I roll my own with some sort of autosizing table layout panel hosting a collection of custom controls?
I know this is pretty easy to make using WPF using the stackpanel layout along with a series of user controls containing grid controls for internal layout. Or are you using windows forms?
The wireless network dialog isn't using a standard Win32 control, it's using a custom control (effectively).
If you want to emulate that behavior, you're going to have to use WPF or roll your own.
Not an exact answer but you may want to look at the various Vista TaskDialog libraries and dialogs that have been based on that. You may be able to borrow some of the code since they share some UI functionality. I need to do the something similar with WPF.
Using .NET 2.0 with WinForms, I'd like to create a custom, multi-columned menu (similiar to the word 2007 look&feel, but without the ribbon).
My approach was creating a control, and using a left/right docked toolstrip, I have constructed a similar look&feel of a menu. However, there are a few shortcomings of this solution, such as
the control can only be placed, and displayed within the form;
if the form is too small, some area of the control won't be displayed;
the control also have to be manually shown/hidden.
Thus, I'm looking for a way to display this control outside of the boundaries of the application. Creating a new form would result in title-bar deactivating on display, so that's also out. Alternatively, any other approach to create a customized menu would be very welcomed.
Edit: I don't want to use any commercial products for this; and since it's about a simple menu customization, it's not related to Microsoft's ribbon "research" in any way.
unless you are in the business of providing .net components, you should be looking to buy it off the shelf. Its a lot of work getting such a control right - There are already vendors providing this kind of UI. e.g. ComponentOne
if you are trying to build this component as a product, you should look at the link below. Apparently Microsoft has a 'royalty-free' license around the Office UI to protect their R&D investments. As of now you need to tell them that you are using something similar to the Office UI. More of that here
The MenuStrip class has a Renderer property. You can assign your own ToolStripRenderer derived class to customize the painting. It's a fair amount of work.