I have an UltraGrid that has one column that may have a lot of data in it to display (but not edit). I set the CellActivation = Activation.ActivateOnly and VertScrollBar = true. This works fine. When the user clicks on a cell with a lot of data the vertical scroll bar appears as expected however the fomatting in the cell is lost. How can I retain the formatting while keeping the vertical scroll bar functionality. I tried to post a before and after screen shot but the site only allowed me to post 1 attachement so here is the after shot.
Hi Mike,
After my last post I realized that I did not address the issue of using an editor that you raised. The answer is yes I am using an EditorWithText. Here is the code:
EditorWithText
();
textEditor.DataFilter =
ugNursingAssessment.DisplayLayout.Bands[0].Columns[
].Editor = textEditor;
public
class TextEditorDataFilter : IEditorDataFilter
{
public virtual object Convert(EditorDataFilterConvertArgs convertArgs)
if(convertArgs.Direction==ConversionDirection.OwnerToEditor)
convertArgs.Handled =
true;
string strVal = "";
if (convertArgs.Value is string)
strVal = convertArgs.Value
as string;
}
if (convertArgs.Value is DBNull)
return "";
else
return strVal.Replace("\n", "\r\n");
else if(convertArgs.Direction==ConversionDirection.EditorToOwner)
return strVal.Replace("\r\n", "\n");
else if (convertArgs.Direction == ConversionDirection.EditorToDisplay)
return convertArgs.Value;
else if (convertArgs.Direction == ConversionDirection.DisplayToEditor)
throw new Exception("Something is wrong.");
This was your suggestion from one of your earlier posts of replacing the single newline character "\n" with "\r\n". If this is not correct...then what would you suggest?
Thanks
Omer
I can't compile your project becuase we do not have v9.2 of the Infragistics2 dlls. The latest version we have is v8.3. Would this make a difference? If not, could you please resend your project using the 8.3 version of these dlls instead?
Hi Omer,
I just tested this out in a small sample project just to make sure the grid is working as I expect, and this all seems to work fine for me.
Perhaps your column is using an Editor or an unusual Style that is preventing this from working.
I'm attaching my sample here. When I run this sample and click on the cell (there's only one), I can clearly see the text shift from GDI+ to GDI.
If I uncomment the line of code in the InitializeComponent that sets the TextRenderingMode to GDI and then run the app and click on the cell, there is no shifting.
This particular grid gets refreshed every 30 seconds to display any data that might have changed. The SetGridProperties is called every time the grid is refreshed. So to answer your question; it is not called in the form's constructor.
I did however try your suggsetion:
NursingProgressNotesView()
// This call is required by the Windows.Forms Form Designer.
InitializeComponent();
ugNursingAssessment.TextRenderingMode =
.GDI;
and it didn't make a difference.
When does the SetGridProperties method get called?
You don't want to set the TextRendering mode in an event of the grid like BeforeCellActivate. That certainly won't work. This is the kind of property that you should ideally be setting either at design-time or very early on in the initialization of your app, like in the form's Constructor immediately following the InitializeComponent call.