[Lazarus] Setting a groupbox caption bold?

Werner Pamler werner.pamler at freenet.de
Mon Apr 1 00:42:45 CEST 2019


Am 01.04.2019 um 00:09 schrieb Bo Berglund via lazarus:
> I have a configuration setting form where I have used group boxes to
> collect properties that belong together.
> But the groupbox border is not really well defined so I would like to
> be able to augment the form visually by setting the caption of the
> group boxes to bold.
> But I find no such property for the group box...
>
> Is there a way or am I out of luck?

I use this code for TGroupbox, TRadiogroup and TCheckGroup:

procedure BoldGroup(AControl: TWinControl);
var
   i: Integer;
   propinfo: PPropInfo;
   cntrl: TControl;
   fnt: TFont;
begin
   for i:=0 to AControl.ControlCount-1 do begin
     cntrl := AControl.Controls[i];
     propinfo := GetPropInfo(cntrl, 'ParentFont');
     if propinfo <> nil then
       SetOrdProp(cntrl, propinfo, Longint(false));
     propinfo := GetPropInfo(cntrl, 'Font');
     if propinfo <> nil then begin
       fnt := TFont(GetObjectProp(cntrl, 'Font'));
       fnt.Style := [];
       SetObjectProp(cntrl, 'Font', fnt);
     end;
   end;
   AControl.Font.Style := [fsBold];


More information about the lazarus mailing list