I'm using a prededefined office style lib in my app.
I like to override some appearance in a UltraWinGrid: I have multiline text in a cell. If enter edit mode the text appears selected and it moves a little bit to the right. Sometimes this forces a additional line break and not all the text is visible anymore.
Which appearance property I have to override so that text in edit mode is placed always at the some position (margins,?). Is it possible to change it directly in the style library?
Thanks for any help.
Markus
Hi Markus,
By default, the text in the grid (or any of the Infragistics Winforms controls) draws using GDI Plus. When you enter edit mode in a cell, depending on the data type, it may be using an inbox TextBox control, which uses GDI. So this might cause the text to appear to shift a little.
The easiest thing to do is make the control, or the whole application, use GDI - that way everything is consistent.
You can do this by setting the TextRenderingMode property on the control (the grid in this case).
Or you can set it for the whole application by setting a static property:
Infragistics.Win.DrawUtility.UseGDIPlusTextRendering = false;
Hello Mike,
I have found this in another post already, but it does not solve the problem (Version 11.1.20111.2030)
In Main() of my app:
Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault( false ); Infragistics.Win.AppStyling.StyleManager.Load( styleLibrary ); // 2011.2 office black
In the constructor of my form:
this.GridStandard.TextRenderingMode = TextRenderingMode.GDI;
After enter edit mode, the text makes a linebreak (see attached pic). Any other ideas?
Regards
I have attached my test app.
Directions:
After Start click on "Scheduling\Using UltraDataSource". Expand "Department_0" and click on the button "ServiceNote on" at the bottom. You see a multiline cell text.
If you click on that cell, edit mode is set an the text is still fine. This is if no .ISL file is loaded and GDIPlus rendering is switched off. In the Main() of the app, loading of the .ISL file is commented out and GDIPlus is switched off. If you run the app with loading the .ISL file, you can not see the whole text (it's even truncated in non edit mode). The .ISL file is a original Infragistics style library (office black).
In initialize_Layout
band2.Override.RowSizingArea = RowSizingArea.EntireRow;band2.Override.RowSizing = RowSizing.AutoFree;band2.Override.CellMultiLine = DefaultableBoolean.True;
In Init_Row
e.Row.PerformAutoSize();
Where can I modify the ISL file that the text is always shown in the cell when enter edit mode?
The difference appears to be the spacing between characters. There is more space in between the characters when you load the isl file.
I'm not sure why that is - it's probably because the Isl file is changing the font. It looks like you are using Segoe UI and there are a bunch of known issues with this font regarding text measurement.
The columns are not automatically resized to their contents in this case, because the mutliline column is not visible initially and you are never autosizing the columns after that. You can do this by calling PerformAutoResize on the column. Be sure to pass in the proper parameters to this method. You will probably want to pass in AllRowsInBand.
Hi Mike,
I did not set any font explicit. Everything is default. Where I can change the default font in the .ISL file? Which font du you suggest for not having "known issues"?
I don't resize columns, I resize just rows because want every column having the same width. Every column stands for one day. It looks "fluttery" if every column has its own size. The rows are resized in the Initialize_Row event and the PerformAutoSize for the row takes no parameters.
I have found a post, where you explained from where the app stylists picks the font:
http://community.infragistics.com/forums/p/55451/285266.aspx#285266
Knowing this, I see in VS2010 that the font is Microsoft Sans Serif 8.25pt (Default). I did not change the font at runtime.
To solve my problem, do you suggest another font to use?
The sample application you posted isn't setting any fonts in code, but the isl file you are loading is changing the font to SegoeUI. So that's why the text is changing.
You could remove this from the isl file or use some other font, but your users could have their system settings set to use large fonts or small fonts and that would cause you the same issue.
The best thing to do is to autosize the columns. If you want all of the columns to be the same size, then what you could do is AutoSize each column, then find the one with the largest width and use that width for every column.
sorry if I explained maybe not correct. I did not modify the ISL file from your default. Therefore I did not expect that the inbox control font affect all controls.
However, playing around with switching GDIplus rendering on/off and different ScaleMode of the form, I'm not able to achieve my requirements as I told you. The text is still moved a little bit in edit mode :-((
It seems that you don't have a solution either. Therefore we can close this thread.
mac_swit said:In the ISL file, the font you mentioned is only set to inbox controls.
That's not the case in the isl file you posted with your sample project. You are indeed setting the font on a few of the inbox controls specifically. But you are also setting the font on the Base UIRole to Segoe UI. So that will affect all of the Infragistics controls in the whole application.
It's the same in the new isl file you posted here.
mac_swit said:Is it possible to turn off all system settings so that the text looks every time in default font (MS Sans Serif 8.25) or any other font I like?
I'm not sure it's possible to stop Windows from changing the font size. This is part of the operating system. You can try setting the ScaleMode on the form. That might do it.
In the ISL file, the font you mentioned is only set to inbox controls. I could not find any other font setting. I have attached the ISL file I'm using. Please tell me where I should remove the font for UltraWinGrid.
The "master" criteria of my column width is the data in band1 (no indentation). The text users can edit and we talking about is in band2 (see attached pics). The last '1' disappears in edit mode. If so, it's even possible to AutoSize while the cell is in edit mode?
Is it possible to turn off all system settings so that the text looks every time in default font (MS Sans Serif 8.25) or any other font I like?
If I use global app style and default font I expect that this is used at runtime. Is that not possible?
Thank you for your help.