Font Size Keeps Changing

Posted by: chasjimenez04 on 27 September 2017, 9:13 pm EST

    • Post Options:
    • Link

    Posted 27 September 2017, 9:13 pm EST

    Using CiFlexGrid 4.0.20171.248 with Windows 7 Pro and VS2015 Update3.

    I have several grids in my application whose column font sizes keep changing on me for no apparent reason. Sometimes only the column caption font changes, sometimes only the rest of the column, sometimes both. They are all set to the default of Arial 8pt. I have not changed any fonts from the top-level default of the grids. The sizes change randomly to something smaller and fractional, such as 5.785, or 6.239. This usually happens when I make some other design-time change to the grid, not involving fonts.

    To correct, I have to go into the “Column Tasks” of the designer and change them back to 8 pt.

    Any idea what may be causing this?

    Thank you

  • Posted 27 September 2017, 9:13 pm EST

    Hi,

    We could not reproduce the issue at our end using the same environment and C1 build version as yours.

    It would be great if you could share your application or at least a stripped down version of your application, so that we could reproduce the issue at our end too. Also it would be very helpful for us in narrowing down the issue, if you could share a video file demonstrating the randomly occurring behavior.

    Thanks,

    Pragati

  • Posted 27 September 2017, 9:13 pm EST

    Hi Pragati,

    I can’t share the application with you, but I have attached two screen shots showing the problem.

    Picture 'Font Size Change1.png shows the running application. In the area of the message type distribution, you can see the Column header ‘Msg Type’ has a smaller font than the other two column headers. Also, the column data for both the ‘Msg Type’ column and the ‘Count’ column have changed to a smaller font. But the column header for the ‘Count’ column did not change. You can see the same effect in the Final Status Distribution area, too. The changes occur randomly. It is not always the same columns or headers that change.

    Picture ‘Font Size Change2.png’ shows design-time, editing the ‘Msg Type’ column caption style. You can see the font size changed to something weird. It is always random, but also always some size smaller, never bigger.

    Just to re-iterate, I do not ever change the font sizes in anyway or in any area of the component. I always use the default 8 pt.

    It is worth noting that I have many applications that use the C1FlexGird component, but only two or three have shown this issue. All of the application affected have two things in common 1) there are multiple instances of C1FlexGrid used, and 2) Some of the C1FlexGrid have multiple Custom Styles that I created for them. However, none of the styles modify the Font, only background and foreground colors.

    Hope this additional information helps you track this down.

    Regards,

  • Posted 27 September 2017, 9:13 pm EST

    I could not add the second file in my previous response. The ‘+’ button did nothing - just took me to the top of the page.

    Here is the second file.

  • Posted 27 September 2017, 9:13 pm EST

    Hello,

    Thanks for attaching the screen-shots.

    However, creating a simple application with multiple C1FlexGrids, we could not reproduce the issue at our end. Please refer to attached screen-shot.

    Please modify the sample application replicating to yours, so that we may reproduce the issue at our end and help you better.

    Thanks,

    Ruchir Agarwal

    2017/05/Prj_FontSize.zip

  • Posted 27 September 2017, 9:13 pm EST

    I have not been able to get the issue to happen with the test application you provided to me.

    I have attached a ZIP file containing two versions of the the main form resource file. The first one (frmMain - Copy.GoodresX) is the good one where the fonts are displayed the correct size. The second one (frmMain - Copy.BadresX) is where the font sizes have changed. Search for the line containing “grdMessageTypes.ColumnInfo” in both files and note the difference in font sizes specified. I did not make this change. It happens somehow by itself, and I continuously have to go back and modify the font sizes in the designer back to 8 pt.

    Note however, that even after setting the font sizes to 8 pt, it is saving the values to the resource file as 7.758pt. Why is this?

    Also I see that most of my other grids do not have font sizes specified in their “ColumnInfo” sections. This explains why they never change. Since I do not need a different size, how can I remove the font sizes completely from the “ColumnInfo” data (hopefully without manually editing). I think this would solve my problem, but it sure seems like there is a bug somewhere. Maybe in the Visual Studio IDE?? (I am using VS 2015 Update 3.

    Thank you for your assistance.

    Charlie

    2017/06/ResourceFiles.zip

  • Posted 27 September 2017, 9:13 pm EST

    Hi Charlie,

    Thank you for sharing the resource files and your observations with us.

    >>Note however, that even after setting the font sizes to 8 pt, it is saving the values to the resource file as 7.758pt. Why is this?

    It appears that the Column’s font size is being auto scaled to account for the font size set change done at the grid level. We are discussing this with our development team and will share the details as soon as there’s an update.

    Regarding removing the font sizes completely, you can manually change it for the erring columns via the ‘Column Tasks’ designer.Since this might be tedious task,an easier approach would be to set the font-sizes from the code, for example:

    [csharp]var style = c1FlexGrid1.Styles.Add(“ColumnStyle”);

    foreach (Column column in c1FlexGrid1.Cols)

    {

    if (column.Style == null)

    column.Style = style;

    column.Style.Font = new Font(c1FlexGrid1.Font.FontFamily, 8);

    }[/csharp]

    Please let us know if this helps.

    Regards,

    Ankit

  • Posted 27 September 2017, 9:13 pm EST

    Hi Ankit,

    Thank you for your feedback. Actually, I went ahead and edited the resource file (yes, I know, dangerous, as I have done this in the past and gotten myself into big trouble with the designer not loading). But I was extremely careful, studying the format, placement of semi-colon and braces, etc., and was successful. But I would not recommend doing this. However, I have had no further problem with the fonts. Nevertheless, I will keep your suggestions in mind if it ever happen again. I think setting the font sizes from code would be the best approach.

    I hope your development team can correct this issue.

    Thanks again for all your help.

    Regards,

    Charlie

  • Posted 27 September 2017, 9:13 pm EST

    Hi Charlie,

    We too won’t recommend editing the resource files to change the ColumnInfo. It can be troublesome as you might have observed.Glad to know though that your risk paid off and the problem was resolved:)

    We will update this thread as and when we hear from the development team regarding the issue. Meanwhile, please feel free to create another post for any further queries you might have.

    Regards,

    Ankit

  • Posted 12 March 2018, 2:36 am EST

    Hi Charlie,

    We’ve an update on the autoscaling of font from our development team. This is a design behavior of the grid as all sizes of the grid are recalculated when C1FlexGridBase.Font changes and it is used by our other components (C1TouchToolKit and C1Sizer).

    Regards,

    Ankit

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels