öncelikle formumuza bir tane ApplicationEvents nesnesi koyuyoruz
Kodlar
___________________________________________
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, AppEvnts, Menus;
type
TForm1 = class(TForm)
ApplicationEvents1: TApplicationEvents;
MainMenu1: TMainMenu;
gfg1: TMenuItem;
gfg2: TMenuItem;
f1: TMenuItem;
gf1: TMenuItem;
procedure ApplicationEvents1Activate(Sender: TObject);
procedure ApplicationEvents1Deactivate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
FOldMenuColor: TColorRef;
FOldMenuTextColor: TColorRef;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.ApplicationEvents1Activate(Sender: TObject);
var
newcolors: array[0..1] of TColorRef;
indices: array[0..1] of Integer;
begin
FOldMenuColor := ColorToRGB(clMenu);
FOldMenuTextColor := ColorToRGB(clMenuText);
newcolors[0] := ColorToRGB(clAqua);
newcolors[1] := ColorToRGB(clNavy);
indices[0] := COLOR_MENU;
indices[1] := COLOR_MENUTEXT;
SetSysColors(2, indices, newcolors);
end;
procedure TForm1.ApplicationEvents1Deactivate(Sender: TObject);
var
newcolors: array[0..1] of TColorRef;
indices: array[0..1] of Integer;
begin
newcolors[0] := FOldMenuColor;
newcolors[1] := FOldMenuTextColor;
indices[0] := COLOR_MENU;
indices[1] := COLOR_MENUTEXT;
SetSysColors(2, indices, newcolors);
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
ApplicationEvents1Deactivate(self);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
end;
end.
________________-
not: alıntıdır : iyi çalışmlar arkadaşlar