1 (edited by prahousefamily 2018-11-26 04:43:57)

Topic: Setting Font Default All Component

How To Setting Font Default All Component In MVD ?

  • Font Name
    Font Size

in Component

  • Button
    TextBox
    Memo
    Richedit
    Combobox
    Checkbox
    Dattimepicker
    Tablegrid
    Treeview
    Groupbox
    PageControl

My Visual Database : I Love You
Easy For Beginner Student For Me

Re: Setting Font Default All Component

Hello prahousefamily,

You have to iterate through all the form component and checking their type before setting font styles, colors and so on


You can do that like so :


procedure Form1_OnShow (Sender: TObject; Action: string);
var
    i : Integer;
begin
    for i := 0 to  Form1.ComponentCount - 1 do
        begin
            if Form1.Components[i] is TdbEdit then TdbEdit(Form1.Components[i]).Font.Style := fsBold;
            if Form1.Components[i] is TdbMemo then TdbMemo(Form1.Components[i]).Font.Style := fsBold;
            if Form1.Components[i] is TLabel then Tlabel(Form1.Components[i]).Font.Style := fsBold;

            //and so on....
        end;
end;

This example was given changing a font style to bold, but this works for color, size etc...


For a complete list of components and how to iterate through them, have a look here on the forum :

http://myvisualdatabase.com/forum/viewtopic.php?id=3053
the lasts posts are very interesting


Hope this helps


Cheers


Mathias

I'm a very good housekeeper !
Each time I get a divorce, I keep the house

Zaza Gabor