Topic: increase or decrease font size at run time

procedure frmNumber_OnKeyDown (Sender: TObject; var Key: Word; Shift, Alt, Ctrl: boolean);
begin //*** Proc 905 - aumenta e diminui o tamanho da fonte com teclas de atalho
     if (Key = ORD('A')) and Shift and Ctrl then
     begin
          frmNumber.ComboBox1.Font.size := frmNumber.ComboBox1.Font.size + 1;
          frmNumber.edNumber.Font.size := frmNumber.edNumber.Font.size + 1;
          frmNumber.Memo1.Font.size := frmNumber.Memo1.Font.size + 1;
     end;
     if (Key = ORD('D')) and Shift and Ctrl then
     begin
          frmNumber.ComboBox1.Font.size := frmNumber.ComboBox1.Font.size - 1;
          frmNumber.edNumber.Font.size := frmNumber.edNumber.Font.size - 1;
          frmNumber.Memo1.Font.size := frmNumber.Memo1.Font.size - 1;
     end;
end;

begin
     //*** ATENÇÃO: keypreview também pode ser acionado em PROPRIEDADES
     frmNumber.KeyPreview := True; //*** Proc 905 - aumenta e diminui o tamanho da fonte com teclas de atalho
end.
Roberto Alencar

Re: increase or decrease font size at run time

Hi Roberto,
If you want to increase / decrease the font size for all the edit, combobox and memo objects on a form, you could also do it something like this (see attached) which should save a bit of typing!
The attached example  uses ALT + A and ALT +D to increase / decrease the font
I sometimes find it useful to change font size, change object colour etc on forms that have a lot of input fields to make it easier for the user to see where they are (but obviously that is more interactive (ie when you actually enter / leave the input fields))
Regards,
Derek.

Post's attachments

Attachment icon font size on the fly.zip 442.97 kb, 46 downloads since 2024-01-02 

Re: increase or decrease font size at run time

derek wrote:

Hi Roberto,
If you want to increase / decrease the font size for all the edit, combobox and memo objects on a form, you could also do it something like this (see attached) which should save a bit of typing!
The attached example  uses ALT + A and ALT +D to increase / decrease the font
I sometimes find it useful to change font size, change object colour etc on forms that have a lot of input fields to make it easier for the user to see where they are (but obviously that is more interactive (ie when you actually enter / leave the input fields))
Regards,
Derek.

Hi Derek! You are always helpful! Thank you for simplifying and at the same time expanding the scope of font enlargement and reduction. I find this very useful in my case, as I have some difficulty with my vision, resulting from surgery, and this feature helps a lot. Happy 2024!

Roberto Alencar

Re: increase or decrease font size at run time

Hi Roberto,
Another option might be to use the 'scaleby' function rather than altering the font size (although I do appreciate that there are a couple of issues with 'scaleby' - specifically with scaling tablegrids).
Maybe this also helps.
Regards,
Derek.

Post's attachments

Attachment icon scaleby jrga.zip 443.17 kb, 48 downloads since 2024-01-04