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. Image for the cookie policy date
close icon

Inherited Font Style

Hi, I'm having some unexpected values for my Font values when I'm dealing with inherited font styles from Row/Columns. I'm uncertain what it should be doing, but there does seem to be a consistancy problem at least. I've used the CellStyle samples as my test case (working with a blank row which doesn't have any formatting to start with). I selected the whole table, and set the font to Arial. Then I selected a row, and set Bold true (interestingly the property grid lists the Font as Helvetica). I select a cell in the previously selected row. The property grid reports that it has Arial font and is bold. But the actual font being used appears to be Helvetica. This only seems to happen when the row (or column) style changes one of the Font properties. I would like the font to be Arial (as the property grid indicates it should be), so is this just a drawing problem or is it reporting the incorrect font? Thanks, Sue

8 Replies

AD Administrator Syncfusion Team May 20, 2003 07:02 AM UTC

Did you derive from GridFontInfo? I am not sure if that is easily supported. I would have to research this. The reason is that GridStyleInfo creates GridFontInfo objects and not derived classes. I assume what you try to accomplish is to limit the properties displayed in the property grid for the style and also the properties for its subobject (also fonts, borders etc.) ? I can check if we can provide some property in the style class where you can specify an array of Property Names that you would like to be visible. Let me know if that would help. Stefan


SH Sue Harris May 21, 2003 06:35 PM UTC

> Did you derive from GridFontInfo? I haven't changed your GridStyles sample at all. The sample seems to be setting the font using the ChangeCells method. The problem here is more that related to the fact that I'm fetching the font name to display as the current font in a toolbar, but the font being reported does not appear to the font being used when drawing the cell. > I can check if we can provide some property in the style class where you can specify an array of Property Names that you would like to be visible. Although this doesn't apply to this problem, this certainly sounds like a wonderfully useful feature (I use a overrided TypeConverter to do this in another class). Thanks, Sue


AD Administrator Syncfusion Team May 21, 2003 09:20 PM UTC

Oh, ok. I confused this a bit with the other question you had with the identity. The problem here is that the row style itsself does not inherit its settings from the table style. Inheritance only takes place for the cells inside the row once you access a specific cell. So the cells inside the row draws correctly inheriting the bold setting from the row and the facename from the table style, but the row style by itsself does not report that value. Only the row headers themselves will still use the Helvetica font. I think it makes sense to change that inheritance pattern here for row and column styles so that they reflect the table style. We'll make those change in the grid source code. Stefan


SH Sue Harris May 21, 2003 10:34 PM UTC

Excellent. That will certainly solve the problem. But as question of interest: Why does the cell styles returned by the GetCombinedStyle(GridRangeInfo.Cell(1,1)) [for example], report the font as Arial (as an inherited property, the HasFontName is false), but _draw_ the cell using Helvetica? Does the drawing code use a different method to get the properties to draw with. Many, many thanks, Sue


AD Administrator Syncfusion Team May 22, 2003 03:44 PM UTC

If you get the style for Cell(1,1) and it reports Arial it will also the draw cell with Arial font. Otherwise this would be really odd since the drawing routine gets the font from that style. Try putting a Trace statement and check for Cell(1,1).Font.FaceName. That's the font that is used for drawing. You can also get the GDI+ font that is created with Cell(1,1).Font.GdipFont Stefan


SH Sue Harris May 25, 2003 06:43 PM UTC

> If you get the style for Cell(1,1) and it reports Arial it will also the draw cell with Arial font. Otherwise this would be really odd since the drawing routine gets the font from that style. OK, something really odd is going on. I put in the trace, it is reporting what I see in the style, but it certainly isn't drawing it that way. Could you please run the following steps and let me know if it is working for you? 1. Run the CellStyle sample 2. in row 7, type some text in a cell (this row doesn't have any other style settings) 3. select the table and set the font to Arial 20. 4. select row 7, and turn bold on. At this point, my row 7 cell is drawing as (I think) Helvetica 8.25. The cell definitly is reporting as Arial 20 (as is the GdiFont), but if I change the cell font away from Arial and then back again (so the font is set on the cell) the formatting changes. Does this happen for you? Thanks, Sue


AD Administrator Syncfusion Team May 28, 2003 10:47 AM UTC

It does not happen for me with the latest build on my machine, but I haven't tried with earlier versions of grid. If the problem continues to exist even with the 1.6 version for you then just let me know again. Stefan


SH Sue Harris June 10, 2003 02:16 AM UTC

Thanks Stefan, This all works perfectly now in 1.6 RC1 (including the row/col styles inheriting the table style). Thanks, Sue

Loader.
Live Chat Icon For mobile
Up arrow icon