The function IsRTF() works. Seems you have already done displaying RTF in xbrowse cell. Is it the same code you are using? Can you post your full code for display of rtf ?
NageswaraRao, no I am sorry. I used ComponentOne’s FlexGrid with VB.NET for the demo screen. But I think it is very similar what we have in our xBrowser.
Regards, Otto
Dim _rtf As New RTF Private Sub _flex_OwnerDrawCell(ByVal sender As Object, ByVal e As C1.Win.C1FlexGrid.OwnerDrawCellEventArgs) Handles _flex.OwnerDrawCell
' check whether the cell contains RTF Dim rtfText As String = _flex.GetDataDisplay(e.Row, e.Col)
If (rtfText.StartsWith("{\rtf")) Then
' _flex.Rows(e.Row).Height = GetDisplayHeight(_flex(e.Row, 3), _flex.Cols(3).WidthDisplay) ' it does, so draw background e.DrawCell(DrawCellFlags.Background)
' draw the RTF text _rtf.Rtf = rtfText _rtf.ForeColor = e.Style.ForeColor _rtf.BackColor = e.Style.BackColor _rtf.RenderTo(e.Graphics, e.Bounds)
' and draw border last e.DrawCell(DrawCellFlags.Border)
The richedit control has to paint "itself" so we need to have a richedit control for each visible cell that wants to show formatted text.
So if you have a column that shows 20 rows and each cell shows RTF text, then we need to have 20 richedit controls, childs of the xbrowse.
We can not create a richedit control everytime we paint a cell, as you tried in your code, or the application will collapse. We need to create a certain amount of richedit controls only, and change their contents as the browse scrolls up or down.
We could start defining a new DATA in the Class TXBrwColumn:
DATA aRichEdits
that will hold an array of richedit controls, one by each visible cell of that column. When the browse is resized, then we have to redimension the array with more or less richedit controls.
When we scroll up or down, then we should change the richedits text with the next cell text. We should test how fast (or slow) this will be.
I think ComponentOne’s FlexGrid does create every time you address a column a new Dim _rtf As New RTF. I don’t have the working code on my HomePC. But in real use I think you don’t have more than 20 RTF-cells opened at the same time.
I haven't used flex grid. Please tell me does this flex grid scrolls up and down like our browses or does it paint in pages and should we flip the pages