We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GDBG: RichText...

Thread ID:

Created:

Updated:

Platform:

Replies:

62966 Jun 26,2007 02:39 PM UTC Jun 27,2007 11:48 PM UTC WinForms 13
loading
Tags: GridControl
Alex
Asked On June 26, 2007 02:39 PM UTC

Hi,
1) Is there an easy way to disable arrow in each cell ('RichText' type) of GridDataBoundGrid control?

2) On which event i should use Syncfusion.Drawing.RichTextPaint.DrawRichText(...)? I'd like to use this method to make the rich text not wrapable.

3) Which property of GDBG i should use to get richTextControl, which is hosted in a cell and which i should put as argument in DrawRichText(...)?

Alex
Replied On June 26, 2007 02:44 PM UTC

In 1) i mean not to disable but HIDE an arrow.

haneefm [Syncfusion]
Replied On June 26, 2007 02:47 PM UTC

Hi Alex,

1) Is there an easy way to disable arrow in each cell ('RichText' type) of GridDataBoundGrid control?
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
You can hide dropdown(arrow) button by setting the style.ShowButtons property for the cells to GridShowButtons.Hide. Below is a code snippet

GridStyleInfo style = this.grid.Binder.InternalColumns["RichTextColumn"].StyleInfo;
style.ShowButtons = GridShowButtons.Hide;

2) On which event i should use Syncfusion.Drawing.RichTextPaint.DrawRichText(...)? I'd like to use this method to make the rich text not wrapable.
And
3) Which property of GDBG i should use to get richTextControl, which is hosted in a cell and which i should put as argument in DrawRichText(...)?
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
You can do is to handle the DrawDisplayText event and draw the text yourself in a way that works with the WrapText using the DrawRichText static method.

[c#]
Syncfusion.Drawing.RichTextPaint.DrawRichText(e.Graphics, rtb, rtf, this.gridControl1.PrintingMode , Bounds1, e.TextRectangle, Bounds2, e.Style.BackColor, false, 100, false);

Here is a forum thread that discuss with the DrawRichText method.
http://www.syncfusion.com/forums/message.asp?MessageID=35231

Best regards,
Haneef

Alex
Replied On June 26, 2007 02:55 PM UTC

Thank you for quick answer but this link

http://www.syncfusion.com/forums/message.asp?MessageID=35231

is not working for me. It loads the main forum page.
?

haneefm [Syncfusion]
Replied On June 26, 2007 03:08 PM UTC


Alex
Replied On June 26, 2007 03:34 PM UTC

Ok, thanks but you've said:
"You can do is to handle the DrawDisplayText event and draw the text yourself in a way that works with the WrapText using the DrawRichText static method."


Do you mean the event DrawCellDisplayText of GDBG ? (Which class DrawDisplayText-event is belong to? I cant find it.)

Should i use DrawCellDisplayText(...) with RichTextBox as second argument, or another overloaded version without it?

Article is said:
"Annother alternativ would be to handle the CellDraw event and call RichTextPaint.DrawRichText yourself. After drawing the cell contents set e.Handled = true.
"
CellDraw? or CellDrawn? But as i can see this event has arguments which is not suitable for drawing with help of DrawRichText.





Alex
Replied On June 26, 2007 06:44 PM UTC

Hello again,

I've tried DrawRichText method, but more's the pity it ignores wrapping.

Is there any way to access GridRichTextEntryPanel. It got the public property 'RichTextBox'.
All i need is to set property of ReachTextBox.WorldWrap to false.

Alex
Replied On June 26, 2007 09:40 PM UTC

Hello, I've made a good example to demonstrate the problem. I hope it will help you to help me.

=)

I long for your answer.


WindowsApplication249.zip

Alex
Replied On June 26, 2007 10:02 PM UTC

Sorry, ive made a mistake in comment to file UsualRichTextBox.cs. In question "So the question is how to achieve the appearence of usual RichTextBox which property WordWrap set to true ?" i mean "WordWrap set to false".

haneefm [Syncfusion]
Replied On June 26, 2007 10:21 PM UTC

Hi Alex,

You can access the GridRichTextBoxCellRenderer from CellRenderers collection property and set the WordWrap property false in a RichTextBox. Below is a code snippet

GridRichTextBoxCellRenderer cr = (GridRichTextBoxCellRenderer)this.gridDataBoundGrid1.CellRenderers["RichText"];
if (cr != null)
{
GridRichTextEntryPanel b = cr.DropDownContainer.Controls[0] as GridRichTextEntryPanel;
RichTextBox r = b.Controls[1] as RichTextBox;
r.WordWrap = false;
}

Modified sample : ModifiedWindowsApplication249.zip

Best regards,
Haneef

Alex
Replied On June 26, 2007 10:35 PM UTC

Wow, well done!
Thank you very much, Haneef.
I've spent many hours to do it. And already have a headache about this problem =).
It was very important thing to be done...

Great support, Haneef!

Alex
Replied On June 26, 2007 11:24 PM UTC

Hmm, sorry, but im a little bit tired. And ive taken your modified example for the right thing.
But the problem is that CellType = "Static" in the example and i need it in a "RichText", because i need font formatting in a cell.
So if we comment '#define STATIC' - we'll see the wrong behavor: text is wrapping in spite of "r.WordWrap = false". Is it a bug or something?

Anyway, thank you for your help.

Alex
Replied On June 27, 2007 08:40 AM UTC

Haneef,
would you please give me the working example of using
RichTextPaint.DrawRichText(...); ?
In the example the strings shouldn't be wrapped and a piece of string should have any font formatting.

haneefm [Syncfusion]
Replied On June 27, 2007 11:48 PM UTC

Hi Alex,

There is no property setting that will do this for you. but here is one way.

You can use the DrawCellEvent, and draw this cell yourself. In your code, you would need to check for Richtext type for the cell, and draw the cell if there are RichText type. Here is a try at this.

void gridDataBoundGrid1_DrawCell(object sender, GridDrawCellEventArgs e)
{
if (e.Style.CellType == "RichText")
{
string s = e.Style.Text;
e.Style.Text = "";
e.Renderer.Draw(e.Graphics, e.Bounds, e.RowIndex, e.ColIndex, e.Style);
Rectangle rect = e.Bounds;
rect.Width = this.gridDataBoundGrid1.Width;
RichTextPaint.DrawRichText(e.Graphics, s, false, rect, rect, Color.Pink, rect, false, 100);
e.Cancel = true;
}
}

Please refer to the attached sample for implementation.
ModifiedRichTextBoxApplication.zip

Best regards,
Haneef

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;