Programlarınızın renk ve fontlarını degistirin
aslangeri11.08.2005 - 13:38:44
s.a.

unit RegSetting;

interface
uses registry, graphics, windows, Sysutils, Classes;

// RegSet değişkeninin kullanımı
// 1.CreateRegistryde cerate ediliyor
// 2.FreeRegistry de free ediliyor.
procedure CreateRegistry;
Procedure FreeRegistry;
//InitColor değişkenlere ilk değerlerini veriyor. Fontları Create ediyor.
//(Fontlar Free Edilmiyor) Editlerin styleleride ayırlanıyor
Procedure InitColor;
//LoadColor Registry den değişkenlere değerleri (Font ve renkleri) okutor
Procedure LoadColor;
//SaveColor Registry e Değişkenlerdeki değerleri (Font ve Renkleri) yazıyor
Procedure saveColor;

Procedure LoadColorAndFonts;
Procedure SaveColorAndFonts;

const
//color constants
Fontcolors ='FontColor';
FontSizeS ='FontSize';
FontNames ='FontName';
FontBolds ='FontBold';
FontItalics ='FontItalic';
FontUnderlines ='FontUnderline';

Pbuttons ='PButton';
PButtonColors ='PButtonColor';
PGridFixs ='PGridFix';
PGridFixcolors ='PGridFixColor';
PGridS ='PGrid';
PGridColors ='PGridColor';
PEdits ='PEdit';
PEditColors ='PEditColor';
EditS ='Edit';
EditColorS ='EditColor';
ActiveFontS ='ActiveFont';
ActiveColorS ='ActiveColor';
//style constants
BorderColorS ='BorderColor';
BorderStyleS ='BoderStyle';
ButtonStyleS ='ButtonStyle';
ButtonTransS ='ButtonTransparency';
LeftS ='Left';
RightS ='Right';
TopS ='Top';
BottomS ='Bottom';
HotTrackS ='HotTrack';
ShadowS ='Shadow';
var
PButtonColor,
PGridFixcolor,
PGridColor,
PEditColor,
EditColor,
Activecolor
:Tcolor;
PButtonFont,
PGridFixfont,
PGridFont,
PEditFont,
EditFont,
ActiveFont
:TFont;

mBorderColor:TColor;
mBorderStyle,
mButtonStyle,
mButtonTransparence:integer;
medgLeft,medgRight,medgTop,medgBottom,
mHottrack,mShadow:Boolean;

implementation

const
ColorKey='Software\firmaadi\projeadi\programadi\versiyon\Colors';
StyleKey='Software\firmaadi\projeadi\programadi\versiyon\Styles';
var
RegSet:Tregistry;
bold,italic,underline:boolean;

Procedure Createregistry;
Begin
Regset:=TRegistry.Create;
RegSet.RootKey:=HKEY_LOCAL_MACHINE;
End;

Procedure Freeregistry;
Begin
RegSet.Free;
End;

Procedure LoadColor;
procedure Loadthis(onek:string;var loadingfont:TFont);
Begin
try LoadingFont.color:=RegSet.ReadInteger(Onek+FontColors);
except RegSet.WriteInteger(Onek+FontColors,LoadingFont.Color); end;
try LoadingFont.Size:=RegSet.ReadInteger(Onek+FontSizes);
except RegSet.WriteInteger(Onek+FontSizes,LoadingFont.Size); end;
try LoadingFont.Name:=RegSet.ReadString(Onek+FontNames);
except RegSet.Writestring(Onek+FontNames,LoadingFont.Name); end;
try bold:=RegSet.ReadBool(Onek+FontBolds);
except bold:=false;RegSet.WriteBool(Onek+FontBolds,bold); end;
if bold then LoadingFont.Style:= LoadingFont.Style+[fsbold]
else LoadingFont.Style:= LoadingFont.Style-[fsbold];
try italic:=RegSet.ReadBool(Onek+FontItalics);
except italic:=false; RegSet.WriteBool(Onek+Fontitalics,italic); end;
if italic then LoadingFont.Style:= LoadingFont.Style+[fsitalic]
else LoadingFont.Style:= LoadingFont.Style-[fsitalic];
try underline:=RegSet.ReadBool(Onek+FontUnderlines);
except underline:=false; RegSet.WriteBool(Onek+FontUnderlineS,Underline); end;
if Underline then LoadingFont.Style:= LoadingFont.Style+[fsunderline]
else LoadingFont.Style:= LoadingFont.Style-[fsunderline];
End;
Begin
RegSet.OpenKey(ColorKey,true);
try pbuttoncolor:=RegSet.ReadInteger(PButtoncolors);
except RegSet.WriteInteger(pbuttoncolors,pbuttoncolor); end;
Loadthis(Pbuttons,PButtonFont);

try pgridfixcolor:=RegSet.ReadInteger(Pgridfixcolors);
except RegSet.WriteInteger(pgridfixcolors,pgridfixcolor); end;
LoadThis(PGridfixS,PGridfixFont);

try pgridcolor:=RegSet.ReadInteger(Pgridcolors);
except RegSet.WriteInteger(pgridcolors,pgridcolor); end;
LoadThis(PGridS,PGridFont);

try pEditcolor:=RegSet.ReadInteger(PEditcolors);
except RegSet.WriteInteger(pEditcolors,pEditcolor); end;
LoadThis(Pedits,PEditFont);

try Editcolor:=RegSet.ReadInteger(Editcolors);
except RegSet.WriteInteger(Editcolors,Editcolor); end;
LoadThis(Edits,EditFont);

try activecolor:=regset.ReadInteger(activecolors);
except regset.WriteInteger(activecolors,activecolor); end;
loadthis(ActiveFontS,activefont);
Regset.closekey;
End;

Procedure SaveColor;
Procedure Savethis(onek:string;SavingFont:Tfont);
Begin
RegSet.WriteInteger(Onek+FontColors,SavingFont.Color);
RegSet.WriteInteger(Onek+FontSizes,SavingFont.Size);
RegSet.Writestring(Onek+FontNames,SavingFont.Name);
bold:=fsbold in SavingFont.Style;
italic:=fsitalic in SavingFont.Style;
underline:=fsunderline in SavingFont.Style;
regset.WriteBool(onek+FontBoldS,bold);
RegSet.WriteBool(Onek+Fontitalics,italic);
RegSet.WriteBool(Onek+FontUnderlineS,Underline);
End;
Begin
RegSet.OpenKey(ColorKey,true);
RegSet.WriteInteger(pbuttoncolors,pbuttoncolor);
SaveThis(PButtonS,PButtonFont);

RegSet.WriteInteger(pgridfixcolors,pgridfixcolor);
SaveThis(Pgridfixs,PGridfixFont);

RegSet.WriteInteger(pgridcolors,pgridcolor);
SaveThis(Pgrids,PGridFont);

RegSet.WriteInteger(pEditcolors,pEditcolor);
SaveThis(PeditS,PEditFont);

RegSet.WriteInteger(Editcolors,Editcolor);
SaveThis(editS,EditFont);

regset.WriteInteger(activecolors,activecolor);
savethis(activefonts,activefont);
regset.closekey;
End;


procedure initcolor;
Begin
Pbuttoncolor:=clBtnFace; //Button Panelleri
PButtonFont:=TFont.Create; PButtonFont.charset:=TURKISH_CHARSET;
PButtonFont.Color:=clWindowTexT; PButtonFont.size:=10;
PButtonFont.name:='Verdana'; PButtonFont.Style:=[];
PButtonFont.Height:=-13; PButtonFont.Pitch:=fpDefault;

PGridcolor:=clwindow; //Grid zemin rengi
PGridFont:=TFont.Create; PGridFont.charset:=TURKISH_CHARSET;
PGridFont.Color:=clWindowText; PGridFont.size:=10;
PGridFont.name:='Verdana'; PGridFont.Style:=[];
PGridFont.Height:=-13; PGridFont.Pitch:=fpDefault;

PGridFixColor:=ClBtnFace;
PGridFixFont:=TFont.Create; PGridFixFont.charset:=TURKISH_CHARSET;
PGridFixFont.Color:=clMaroon; PGridFixFont.size:=10;
PGridFixFont.name:='Verdana'; PGridFixFont.Style:=[];
PGridFixFont.Height:=-13; PGridFixFont.Pitch:=fpDefault;

Peditcolor:=clBtnFace; //Giriş yapılan alanlardaki paneller
PeditFont:=TFont.Create; PeditFont.charset:=TURKISH_CHARSET;
PeditFont.Color:=clWindowTexT; PeditFont.size:=10;
PeditFont.name:='Verdana'; PeditFont.Style:=[];
PeditFont.Height:=-13; PeditFont.Pitch:=fpDefault;

Editcolor:=clWindow; //Editların renk ve style leri
EditFont:=TFont.Create; EditFont.charset:=TURKISH_CHARSET;
EditFont.Color:=clWindowTexT; EditFont.size:=10;
EditFont.name:='Verdana'; EditFont.Style:=[];
EditFont.Height:=-13; EditFont.Pitch:=fpDefault;

activecolor:=clinfobk;
ActiveFont:=TFont.Create; ActiveFont.charset:=TURKISH_CHARSET;
ActiveFont.Color:=clWindowTexT; ActiveFont.size:=10;
ActiveFont.name:='Verdana'; ActiveFont.Style:=[];
ActiveFont.Height:=-13; ActiveFont.Pitch:=fpDefault;
//Edit styles
mBorderColor :=$00FF8000;
mBorderStyle :=1;
mButtonStyle :=0;
mButtonTransparence :=1;
medgLeft :=False;
medgRight :=True;
medgTop :=False;
medgBottom :=True;
mHottrack :=True;
mShadow :=False;
End;
Procedure LoadColorAndFonts;
Begin
createregistry;
initcolor;
LoadColor;
Freeregistry;
End;
Procedure SaveColorAndFonts;
Begin
createregistry;
saveColor;
Freeregistry;
End;
Begin
end.


programınıza file-->new-->unit komutunu verin.
açılan penceredekilerin hepsini silip yukardaki kodları yapıştırın.
regsetting.pas olarak kaydedin. (farklı isim de verebilirsiniz tabiki)

Nasıl kullanacağız:
öncelikler registerde yazan değerleri değiştirmek için bir form tasarlamınız gerekmektedir.
file menusunden new-->form komutunu verin.
formun üzerinde farenin sağ tuşunatıklayarak view as text komutunu verin.
ekrandaki tüm yazıları temizleyin. ve aşağıdaki kodu yapıştırın.

object Form1: TForm1
Left = 234
Top = 114
Width = 490
Height = 480
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
OnShow = FormShow
PixelsPerInch = 96
TextHeight = 13
object Panel4: TPanel
Left = 0
Top = 0
Width = 482
Height = 446
Align = alClient
TabOrder = 0
object Label1: TLabel
Left = 3
Top = 58
Width = 80
Height = 13
Alignment = taRightJustify
Caption = 'Seçili Alan Rengi'
FocusControl = ESAlan
end
object Label2: TLabel
Left = 1
Top = 1
Width = 480
Height = 18
Align = alTop
AutoSize = False
Caption = ' Renkler'
Color = clGray
Font.Charset = DEFAULT_CHARSET
Font.Color = clWhite
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
Layout = tlCenter
end
object Label15: TLabel
Left = 30
Top = 84
Width = 53
Height = 13
Alignment = taRightJustify
Caption = 'Liste Rengi'
FocusControl = EListe
end
object Label16: TLabel
Left = 31
Top = 32
Width = 52
Height = 13
Alignment = taRightJustify
Caption = 'Alan Rengi'
FocusControl = EAlan
end
object Label17: TLabel
Left = 243
Top = 32
Width = 84
Height = 13
Alignment = taRightJustify
Caption = 'Alan Zemin Rengi'
FocusControl = EAZemin
end
object Label18: TLabel
Left = 231
Top = 58
Width = 97
Height = 13
Alignment = taRightJustify
Caption = 'Düğme Zemin Rengi'
FocusControl = EDZemin
end
object Label19: TLabel
Left = 244
Top = 84
Width = 84
Height = 13
Alignment = taRightJustify
Caption = 'Liste Başlık Rengi'
FocusControl = ELBaslik
end
object Label20: TLabel
Left = 0
Top = 120
Width = 476
Height = 18
AutoSize = False
Caption = ' Yazı Tipleri'
Color = clGray
Font.Charset = DEFAULT_CHARSET
Font.Color = clWhite
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
Layout = tlCenter
end
object EAlan: TEdit
Left = 87
Top = 28
Width = 80
Height = 21
TabOrder = 0
end
object btnRenkler: TButton
Tag = 1
Left = 172
Top = 26
Width = 53
Height = 25
Caption = '&Renk Seç'
TabOrder = 1
OnClick = RenkSec
end
object ESAlan: TEdit
Left = 87
Top = 54
Width = 80
Height = 21
TabOrder = 2
end
object EListe: TEdit
Left = 87
Top = 80
Width = 80
Height = 21
TabOrder = 3
end
object Button4: TButton
Tag = 2
Left = 172
Top = 52
Width = 53
Height = 25
Caption = '&Renk Seç'
TabOrder = 4
OnClick = RenkSec
end
object Button5: TButton
Tag = 3
Left = 172
Top = 78
Width = 53
Height = 25
Caption = '&Renk Seç'
TabOrder = 5
OnClick = RenkSec
end
object EAZemin: TEdit
Left = 329
Top = 28
Width = 80
Height = 21
TabOrder = 6
end
object Button1: TButton
Tag = 4
Left = 416
Top = 26
Width = 53
Height = 25
Caption = '&Renk Seç'
TabOrder = 7
OnClick = RenkSec
end
object EDZemin: TEdit
Left = 330
Top = 54
Width = 80
Height = 21
TabOrder = 8
end
object Button2: TButton
Tag = 5
Left = 416
Top = 52
Width = 53
Height = 25
Caption = '&Renk Seç'
TabOrder = 9
OnClick = RenkSec
end
object ELBaslik: TEdit
Left = 330
Top = 80
Width = 80
Height = 21
TabOrder = 10
end
object Button3: TButton
Tag = 6
Left = 416
Top = 78
Width = 53
Height = 25
Caption = '&Renk Seç'
TabOrder = 11
OnClick = RenkSec
end
object Button6: TButton
Tag = 1
Left = 20
Top = 146
Width = 205
Height = 25
Caption = 'Alan Yazı Tipi'
TabOrder = 12
OnClick = FontSec
end
object Button8: TButton
Tag = 3
Left = 20
Top = 197
Width = 205
Height = 25
Caption = 'Liste Yazı Tipi'
TabOrder = 13
OnClick = FontSec
end
object Button9: TButton
Tag = 4
Left = 20
Top = 224
Width = 205
Height = 25
Caption = 'Alan Zemin Fontu'
TabOrder = 14
OnClick = FontSec
end
object Button10: TButton
Tag = 5
Left = 20
Top = 251
Width = 205
Height = 25
Caption = 'Düğme Yazı Tipi'
TabOrder = 15
OnClick = FontSec
end
object Button11: TButton
Tag = 6
Left = 20
Top = 278
Width = 205
Height = 25
Caption = 'Liste Başlığı Yazı Tipi'
TabOrder = 16
OnClick = FontSec
end
object Button7: TButton
Tag = 2
Left = 20
Top = 171
Width = 205
Height = 25
Caption = 'Seçili Alan Yazı Tipi'
TabOrder = 17
OnClick = FontSec
end
object Button12: TButton
Left = 72
Top = 352
Width = 75
Height = 25
Caption = 'Kaydet'
TabOrder = 18
OnClick = Button12Click
end
object Button13: TButton
Left = 176
Top = 352
Width = 75
Height = 25
Caption = 'Vazgeç'
TabOrder = 19
OnClick = Button13Click
end
object Button14: TButton
Left = 360
Top = 352
Width = 75
Height = 25
Caption = 'Kapat'
TabOrder = 20
OnClick = Button14Click
end
object Button15: TButton
Left = 264
Top = 352
Width = 75
Height = 25
Caption = 'Varsayilan'
TabOrder = 21
OnClick = Button15Click
end
end
object fd1: TFontDialog
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
MinFontSize = 0
MaxFontSize = 0
Left = 256
Top = 168
end
object ColorDialog1: TColorDialog
Ctl3D = True
Left = 296
Top = 168
end
end


tekrar farenin sağ tuşuna tıklayın ve view as form komutunu verin.
F12 tuşu ile kod kısmına gelin. buradaki yazıları da temizleyin. ve aşağıdaki kodları yapıştırın.

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;

type
TForm1 = class(TForm)
Panel4: TPanel;
Label1: TLabel;
Label2: TLabel;
Label15: TLabel;
Label16: TLabel;
Label17: TLabel;
Label18: TLabel;
Label19: TLabel;
Label20: TLabel;
EAlan: TEdit;
btnRenkler: TButton;
ESAlan: TEdit;
EListe: TEdit;
Button4: TButton;
Button5: TButton;
EAZemin: TEdit;
Button1: TButton;
EDZemin: TEdit;
Button2: TButton;
ELBaslik: TEdit;
Button3: TButton;
Button6: TButton;
Button8: TButton;
Button9: TButton;
Button10: TButton;
Button11: TButton;
Button7: TButton;
fd1: TFontDialog;
ColorDialog1: TColorDialog;
Button12: TButton;
Button13: TButton;
Button14: TButton;
Button15: TButton;
procedure FontSec(Sender: TObject);
procedure RenkSec(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure Button13Click(Sender: TObject);
procedure Button14Click(Sender: TObject);
procedure Button12Click(Sender: TObject);
procedure Button15Click(Sender: TObject);
private
procedure RenkleriKaydet;
procedure RenkleriAyarla;
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

uses RegSetting;

{$R *.dfm}

procedure TForm1.FontSec(Sender: TObject);
begin
case (sender as tcomponent).tag of
1:fd1.font:=ealan.Font;
2:fd1.font:=ESAlan.Font;
3:fd1.font:=EListe.Font;
4:fd1.font:=EAZemin.Font;
5:fd1.font:=EDZemin.Font;
6:fd1.font:=ELBaslik.font;
end;
if fd1.Execute then
begin
case (sender as tcomponent).tag of
1:ealan.Font :=fd1.font;
2:ESAlan.Font :=fd1.font;
3:EListe.Font :=fd1.font;
4:EAZemin.Font :=fd1.font;
5:EDZemin.Font :=fd1.font;
6:ELBaslik.font:=fd1.font;
end;
end;
end;

procedure TForm1.RenkSec(Sender: TObject);
begin
case (sender as tcomponent).tag of
1:ColorDialog1.Color := ealan.color;
2:ColorDialog1.Color := ESAlan.Color;
3:ColorDialog1.Color := EListe.Color;
4:ColorDialog1.Color := EAZemin.Color;
5:colordialog1.Color := EDZemin.Color;
6:ColorDialog1.Color := ELBaslik.Color;
end;

if ColorDialog1.Execute Then
begin
case (sender as tcomponent).tag of
1:begin
EAlan.Color:=ColorDialog1.Color;
EAlan.Text := ColorToString(EAlan.Color);
End;
2:begin
Esalan.Color:=ColorDialog1.Color;
EsAlan.Text := ColorToString(esalan.Color);
end;
3:begin
Eliste.Color:=ColorDialog1.Color;
Eliste.Text := ColorToString(Eliste.Color);
end;
4:begin
EAZemin.Color:=ColorDialog1.Color;
EAZemin.Text := ColorToString(EAZemin.Color);
end;
5:begin
EDZemin.Color:=ColorDialog1.Color;
EDZemin.Text := ColorToString(EDZemin.Color);
end;
6:begin
ELBaslik.Color:=ColorDialog1.Color;
ELBaslik.Text := ColorToString(ELBaslik.Color);
end;
end;
end;
end;
Procedure TForm1.RenkleriKaydet;
Begin
EditColor:=EAlan.Color;
Activecolor:=ESAlan.Color;
PGridColor:=EListe.color;
peditcolor:=EAZemin.Color;
PButtonColor:=EDZemin.Color;
PGridfixColor:=ELBaslik.Color;
editfont.Assign(ealan.font);
activefont.Assign(esalan.font);
PGridFont.assign(eliste.font);
peditfont.assign(eazemin.Font);
PButtonFont.Assign(edzemin.font);
pgridfixfont.assign(elbaslik.font);
End;
procedure TForm1.RenkleriAyarla;
begin
EAlan.Text:=ColorToString(editcolor);
EAlan.color:=(editcolor);
ealan.Font:=regsetting.editfont;
esalan.Text:=ColorToString(activecolor);
esalan.color:=(activecolor);
esalan.Font:=regsetting.activefont;
eliste.text:=ColorToString(pgridcolor);
eliste.color:=(pgridcolor);
eliste.Font:=regsetting.PGridFont;
EAZemin.Text:=colortostring(peditcolor);
EAZemin.Color:=peditcolor;
eazemin.Font:=regsetting.PEditFont;
EDZemin.text:=colortostring(PButtonColor);
EDZemin.Color:=PButtonColor;
EDZemin.Font:=regsetting.PButtonFont;
ELBaslik.Text:=colortostring(PGridFixcolor);
ELBaslik.Color:=PGridFixcolor;
ELBaslik.Font:=regsetting.pgridfixfont;
end;

procedure TForm1.FormShow(Sender: TObject);
begin
LoadColorAndFonts;
renkleriayarla;
end;

procedure TForm1.Button13Click(Sender: TObject);
begin
RenkleriAyarla;
end;

procedure TForm1.Button14Click(Sender: TObject);
begin
close;
end;

procedure TForm1.Button12Click(Sender: TObject);
begin
savecolorandfonts;
end;

procedure TForm1.Button15Click(Sender: TObject);
begin
initcolor;
RenkleriAyarla;
end;

end.


şimdi bu formu kullanarak registere istediğimiz renk ve fontları yazabiliriz. şimdi sırada kullandığımız formlardaki edit ve diğer bileşenlerin renk ve fontlarını değiştirmeye.
bunun için daha iyi yöntemlerde olabilir ama ben bir procedure yazıp o procedureyi çağıracağım.

procedure TFormXXX.RenkVeFontYukle;
begin
PButtons.Color:=PButtonColor; pbuttons.Font.Assign(PButtonFont);
color:=peditcolor; font.assign(peditfont);
EIhaleNo .color:=editcolor; EIhaleNo .font.assign(editfont);
Etanim1 .color:=editcolor; Etanim1 .font.assign(editfont);
ETanim2 .color:=editcolor; ETanim2 .font.assign(editfont);
EITarih .color:=editcolor; EITarih .font.assign(editfont);
CBKb .color:=editcolor; CBKb .font.assign(editfont);
EKBUnvan .color:=editcolor; EKBUnvan .font.Assign(editfont);
CbUye1 .color:=editcolor; CBUye1 .font.assign(editfont);
CbUye2 .color:=editcolor; CBUye2 .font.assign(editfont);
CbUye3 .color:=editcolor; CBUye3 .font.assign(editfont);
CbUye4 .color:=editcolor; CBUye4 .font.assign(editfont);
CbUye5 .color:=editcolor; CBUye5 .font.assign(editfont);
CbUye6 .color:=editcolor; CBUye6 .font.assign(editfont);
CbUye7 .color:=editcolor; CBUye7 .font.assign(editfont);
CbUye8 .color:=editcolor; CBUye8 .font.assign(editfont);
CbUyeR .color:=editcolor; CBUyeR .font.assign(editfont);
EUnvan1 .color:=editcolor; EUnvan1 .font.assign(editfont);
EUnvan2 .color:=editcolor; EUnvan2 .font.assign(editfont);
EUnvan3 .color:=editcolor; EUnvan3 .font.assign(editfont);
EUnvan4 .color:=editcolor; EUnvan4 .font.assign(editfont);
EUnvan5 .color:=editcolor; EUnvan5 .font.assign(editfont);
EUnvan6 .color:=editcolor; EUnvan6 .font.assign(editfont);
EUnvan7 .color:=editcolor; EUnvan7 .font.assign(editfont);
EUnvan8 .color:=editcolor; EUnvan8 .font.assign(editfont);
ERUnvan .color:=editcolor; ERUnvan .font.assign(editfont);
end;

döngüye koyarak da yapılabilir böylelikle sonradan eklenen bileşenlerinde renkleri otomatik olarak değiştirilebilir.

procedure TFormXXX.loadeditfontcolors;
var
i:word;
begin

for i:=0 to ComponentCount-1 do
begin
if components[i] is tdbedit then
Begin
(components[i] as tdbedit).color:=editcolor;
(components[i] as tdbedit).font :=editfont;
end
end;
end;

gibim. seçim size kalmış.

bu procedureyi formun oncreatesine veya onshow una yazmanız gerekmektedir.
Oncreate ile onshow arasındaki fark eğer create olayına yazarsanız renklerde değişiklik yaptığınızda bu değişikliği görmek için programı kapatıp açmanız gerekiyor. onshow a yazarsanız pencereyi kapatıp açmanız kafi.

kolay gelsin.
 
NOT : Bu sayfa google'un siteyi indekslemesi içindir. www.delphiturkiye.com/forum/ adresini kullanınız!
1998-2006 www.delphiturkiye.com