Jump to content


Photo

Setting Row to fsBold changes Size

font bold size

  • Please log in to reply
2 replies to this topic

#1 Frank

Frank
  • Members
  • 21 posts

Posted 10 May 2018 - 02:08 PM

Hi there,

 

in my grid is (under some conditions) text shown with bold style.

 

In NextGrid5 this works perfect (see Screenshot "grid5").

 

In NextGrid6 the size of the font is getting reduced (see File "grid6").

if i remove the fsbold-Style, the fontsize is restored.

 

 

I use this code for Nextgrid6:

if (FieldbyName('STROK').AsString <> 'X') then  
  begin
    for iCnt := 0 to gvData.Columns.Count -1 do
      begin
        gvData.CellBy[iCnt, intRowcnt].Font.Style := gvData.Cell[iCnt, intRowcnt].Font.Style + [fsBold];
      end;
    end;


For NextGrid5, the code is the same, except the property is ".FontStyle"

 

What can i do to preserve the fontsize?

 

Best regards

 

Frank

 

 

Edit: I've noticed the same behavior on changing the color of the font (see "grid6-2.png")

 

 

 

Attached Files



#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 7,645 posts
  • Gender:Male

Posted 10 May 2018 - 06:18 PM

Hi,

I'm not able to reproduce bug, but since Font property of Cell is lazy initialized (to avoid having TFont object on every cell), maybe you can set like:

gvData.CellBy[iCnt, intRowcnt].Font.Style := gvData.Font.Style + [fsBold];
Or, maybe in your case OnStyleText event of column is better idea?
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Members Section: bms.bergsoft.net
Articles and Tutorials: dn.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#3 Frank

Frank
  • Members
  • 21 posts

Posted 13 May 2018 - 03:32 PM

Hello Boki,

 

i'm sorry, but

gvData.CellBy[iCnt, intRowcnt].Font.Style := gvData.Font.Style + [fsBold];

didn't help.

 

I found a workaround by setting the font.size explicit to the desired size after setting font to [fsbold] or changing the color of the font.

 

And, the font size is reduced only if i set the style or the color at runtime. Changing style or color at designtime and then compile and run the program works as expected.

 

Best regards

Frank






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users