08. juni 2002 - 11:30Der er
9 kommentarer og 1 løsning
How to set the default form font in Delphi.
How to set the default form font in Delphi. - by Borland Developer Support Staff
Abstract: Using registry settings to change Delphi IDE defaults.
Question:
How can I set the default form font in Delphi?
Answer:
The value for the default font is stored in the registry. Open the registry editor by entering regedit at the RUN prompt. Go to the key
HKEY_CURRENT_USER\Software\Borland\Delphi\5.0
Here you will add a new key called FormDesign (with no space). To do right click on the 5.0 and chose New | Key. Name the key FormDesign. Now right click on this new key and choose New | String Value. Name this string value DefaultFont (no space). Now right click on this new string value entry in the right window and choose Modify. Enter the name of the default font you would like, followed by a comma and the default size. For example: Arial,10 Now the next time you open Delphi this should be the default font for your forms. You can even go a little further with this if you wish by adding other font properties such as
procedure SetDelphiFont; var FontDlg: TFontDialog; Reg: TRegistry; S: String; begin FontDlg := TFontDialog.Create(nil); if not FontDlg.Execute then begin FontDlg.Free; Exit; end;
with FontDlg.Font do begin S := Name + ',' + IntToStr(Size); if fsBold in Style then S := S + ', bold'; if fsItalic in Style then S := S + ', italic'; if fsUnderline in Style then S := S + ', underline'; if fsStrikeOut in Style then S := S + ', strikeout'; end;
FontDlg.Free; Reg := TRegistry.Create; try Reg.RootKey := HKEY_CURRENT_USER; //Jeg bruger lige frontslash her da Eksperten napper mine backslash'es Reg.OpenKey('/Software/Borland/Delphi/5.0/Form Design/', True); Reg.WriteString('DefaultFont', S); finally Reg.Free; end; end;
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.