Home › Forums › WinForms controls › Xceed Grid for WinForms › Displaying/editing formatted text
-
AuthorPosts
-
#16766 |
Hi all,
1. is it possible to display formatted text in a static/read only field? I really just need bold/italics. My preference would be for the data to be stored in html, but I can be flexible.
2. Does Xceed grid for .Net include a formatted text editor? I can’t see one in the feature list or demos. Is there a ‘conventional’ way of supporting this?
cheers,
Ian
Imported from legacy forums. Posted by ian (had 3947 views)
The grid does not provide a RichTextBox editor/Viewer, which is required to do what you want. You will need to wrap one into a CellViewerManager for this to work.
We have a sample class showing how to implement your own rich text viewer. Find it attached here.
Imported from legacy forums. Posted by André (had 340 views)
Hi André
My developer tried the supplied implementation, but reported:
when we
apply it as CellViewerManager for Entry column, it throws exception in
PaintCellForeground function (in line: this.SetControlValue( cell );).Are you able to provider a higher-level example that demonstrates the wider useage of a RichTextBox editor/viewer. There’s a chance we’re missing something obvious.
cheers,
Ian
Imported from legacy forums. Posted by ian (had 2403 views)
In the class we provided, the RTF property of the TextBox is directly assigned with no formating. Thus the format must already be valid, or else it will throw an exception. The content of the cell must be valid so it can be assigned to the RTF property.
You can simply test this by using the RichTextBox control outside the gird. Simply assigned a value to the RTF property that is the same as a cell value you are using, and see if it throws the exception. If it does, it means the format is not right.
Imported from legacy forums. Posted by André (had 2520 views)
Hi Andre,
We have your code working, but the cell that contains the RTF control on the selected DataRow always has a blue back-color. Is there any way to get rid of this?
We tried to change this line from:
using (SolidBrush backBrush = new SolidBrush(richTextBox.BackColor)) {
to:
using (SolidBrush backBrush = new SolidBrush(Color.Empty)) {
Which reduced most of the blue area, but the area which directly contains text still has a blue area. Any input?
Imported from legacy forums. Posted by Yaron (had 320 views)
Hi Yaron,
This is the normal behavior. If you do not want to have a selected blue back color enabled on your grid control, you should disable it as follow:
this.grid.SelectionVisualStyle.BackColor = Color.Transparent;
this.grid.SelectionVisualStyle.OverrideUIStyle = true; //where grid is an Xceed GridControl
Imported from legacy forums. Posted by Mohamed [Xceed] (had 1136 views)
-
AuthorPosts
- You must be logged in to reply to this topic.