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,
I am not using AppStyling. I used the TextRenderingMode for the grid as you suggested. I tried 2 different ways to implement it:
1. within a function called SetGridProperties -
ugNursingAssessment.DisplayLayout.Bands[0].Columns[
].Header.VisiblePosition = 4;
;
].Width = 370;
.ActivateOnly;
();
textEditor.DataFilter =
].Editor = textEditor;
ugNursingAssessment.UseAppStyling =
ugNursingAssessment.TextRenderingMode =
.GDI;
2. within an eventhandler ugNursingAssessment_BeforeCellActivate
private void ugNursingAssessment_BeforeCellActivate(object sender, CancelableCellEventArgs e)
{
TextRenderingMode.GDI;
}
else
TextRenderingMode.GDIPlus;
Neither method gave me the results I wanted. Any other ideas?
Thanks
Omer
if (e.Cell.Column.ToString() != "Notes")
Hi,
Okay, so the screen shots you posted now clearly show a big difference in the formatting of the cell between when it is in edit mode from when it is out of edit mode. But if you are setting the TextRenderingMode to GDI and that is having no effect, then something else is going on there. There's a pretty clear and obvious difference between the two text rendering modes, and if you're not seeing any change, then either the setting is not being correctly applied or something else is going on here. I'm afraid I don't have any idea what that could be.
Are you sure that the TextRenderingMode is being set, and that you are setting it for the correct control, and that it's not getting re-set back to the original value somewhere in your code?
Are you using AppStyling? Maybe the Style Library you are using is overriding the property setting you are applying in code.
Sorry for the confusion but that was exactly the point I was trying to make...that using TextRendering did not make a difference.
To clear up the confusion let me try to restate my problem - I have a grid with a Notes column that may contain a lot more information than is visible on the screen initially (please see the attached BeforeEditNotesColumn.jpeg file). I would therefore like to have a vertical scroll bar.
From your previous posts you said that the way to do this is by setting the VertScrollBar = true for the column. However this will only work if the cell is in edit mode. Since I do not want the user to change the data I set CellActivation = Activation.ActivateOnly for that column. That produced the vertical scroll bar that I wanted but this time the formatting was off because the data coming from the DB contained a new line character that was used by a rich textbox in another part of the application. I was also able to fix this using your suggestion of using an EditorWithText and a datafilter to replace the new line character with "\r\n".
That helped but the text when it is in edit mode (please see the attached AfterEditNotesColumn.jpg file) is still rendered differenly from when it is NOT in edit mode. You can see these differences by comparing the attached 2 files. This is now the problem I am trying to solve and using the TextRenderingMode as you suggested did not help.
I hope this clears up any confusion. I am still hopeful that there will be a satisfactory resolution to this problem. Thanks for all of your help.
Kind regards
Maybe it's just because it's Friday and I'm a bit tired, but I am looking at your two screen shots and the text looks exactly the same to me. I even use a paint program to copy the text from one and overlay it on top of the other and it is exactly the same right down to the pixel. What am I missing here?
Sorry it has taken me a while to get back to you. To answer your question yes I am using TextRenderingMode.GDI. I am sending you screenshots with and without this set.
However I am a bit confused by your answer. What I am trying to achieve is the same appearrance of the text in the cell when it is & is not in edit mode...or in my case ActivateOnly since I don't want the user to change the text.