You are here: How to > TJSDialog > Changing the font size used for Radio Buttons
LMD DialogPack
ContentsIndexHome
PreviousUpNext
Changing the font size used for Radio Buttons

Describes how to modify the font used for Radio Buttons.

To change the font used for a dialog that contains Radio Buttons, perform the following steps. 

 

  1. Create an OnDialogConstructed event handler.
  2. In the event cast the Sender parameter as a TCustomForm or TForm variable.
  3. Iterate over the Controls on the form variable and for each TRadioButton (or TRadioGroup) control is found, modify the Font property values you want to change.

 

TRadioGroup 

Under some circumstances, the Radio Buttons might be displayed using a TRadioGroup control. This occurs under the following conditions:

  1. The RadioButton.ShowBorder property is True.
  2. The RadioButton.Columns property has a value greater than 1.

 

NOTE: If your application has Windows Themes enabled, you cannot change the font color for a radio button in some versions of Delphi.

Large deviations from the forms default font size are not recommended. This is because controls currently do not realign when the font has been changed.

procedure TForm1.DialogConstructed(Sender: TObject);
var
  I: Integer;
  LForm: TCustomForm;
begin
  LForm := TCustomForm(Sender);
  for I := 0 to LForm.ControlCount - 1 do
  begin
    if LForm.Controls[I] is TRadioButton then
    begin
      TRadioButton(LForm.Controls[I]).Font.Size := 11;
      TRadioButton(LForm.Controls[I]).Font.Color := clBlue;
    end;
  end;
end;
Copyright © 2013 by LMD Innovative. All rights reserved.
Copyright © 2013 by LMD Innovative. All rights reserved.
What do you think about this topic? Send feedback!