Приложение с иконкой в Tray
APPCOMP_DPR.HTM
program AppComp;
uses
Forms,
AppCForm in 'AppCForm.pas' {Form1};
{$R *.RES}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
|
APPCFORM_DFM.HTM
object Form1: TForm1
Left = 195
Top = 107
Width = 439
Height = 273
Caption = 'Application Component Demo'
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -24
Font.Name = 'Arial'
Font.Style = []
ShowHint = True
PixelsPerInch = 96
TextHeight = 27
object Bevel1: TBevel
Left = 8
Top = 72
Width = 193
Height = 161
end
object Label1: TLabel
Left = 24
Top = 24
Width = 72
Height = 27
Hint = 'Label1 Component'
Caption = 'Label1'
end
object Label2: TLabel
Left = 24
Top = 160
Width = 65
Height = 18
Caption = 'Tray Hint:'
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -16
Font.Name = 'Arial'
Font.Style = []
ParentFont = False
end
object cbTray: TCheckBox
Left = 24
Top = 96
Width = 145
Height = 33
Caption = 'Tray Icon'
State = cbChecked
TabOrder = 0
OnClick = cbTrayClick
end
object Edit1: TEdit
Left = 24
Top = 182
Width = 153
Height = 35
MaxLength = 63
TabOrder = 1
Text = 'Tip'
OnChange = Edit1Change
end
object DdhAppExt1: TDdhAppExt
HintColor = clAqua
ShowHint = True
TrayIconActive = True
TrayIcon.Data = {
0000010001002020100000000000E80200001600000028000000200000004000
0000010004000000000080020000000000000000000000000000000000000000
000000008000008000000080800080000000800080008080000080808000C0C0
C0000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF000000
0000000000000000000000000000000000000000007777770000000000000000
0000000000000007000000000000000000000000000000070000000000000000
0000000000777007000000000000000000077070007770070000700000000000
0077000700787000000007000000000007708000077877000070007000000000
07088807777777770777000700000000008F88877FFFFF077887700700000000
00088888F88888FF08870070000000000000880888877778F070007000000007
77088888880007778F770077777000700008F088007777077F07000000700700
008F08880800077778F7700000700708888F0880F08F807078F7777700700708
F88F0780F070F07078F7887700700708888F0780F077807088F7777700700700
008F0788FF00080888F77000007000000008F0780FFFF0088F77007000000000
0008F07788000888887700700000000000008F07788888880870007000000000
00088FF0077788088887000700000000008F888FF00000F87887700700000000
0708F8088FFFFF88078700700000000007708000088888000070070000000000
0077007000888007000070000000000000077700008F80070007000000000000
0000000000888007000000000000000000000000000000070000000000000000
000000000777777700000000000000000000000000000000000000000000FFFF
FFFFFFFC0FFFFFFC0FFFFFF80FFFFFF80FFFFE180E7FFC00043FF800001FF800
000FF800000FFC00001FFE00001FE0000001C000000180000001800000018000
00018000000180000001FC00001FFC00001FFE00001FFC00000FF800000FF800
001FF800003FFC180C7FFE380EFFFFF80FFFFFF80FFFFFF80FFFFFFFFFFF}
TrayHint = 'Here am I, guys!'
TrayPopup = PopupMenu1
OnTrayDefault = Message1Click
OnActivate = DdhAppExt1Activate
OnDeactivate = DdhAppExt1Deactivate
Left = 240
Top = 96
end
object PopupMenu1: TPopupMenu
Left = 248
Top = 152
object Message1: TMenuItem
Caption = 'Message'
Default = True
OnClick = Message1Click
end
object About1: TMenuItem
Caption = 'About...'
OnClick = About1Click
end
object N1: TMenuItem
Caption = '-'
end
object Close1: TMenuItem
Caption = 'Close'
OnClick = Close1Click
end
end
end
|
APPCFORM_PAS.HTM
unit AppCForm;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
DdhAppX, StdCtrls, Menus, ExtCtrls;
type
TForm1 = class(TForm)
DdhAppExt1: TDdhAppExt;
Label1: TLabel;
PopupMenu1: TPopupMenu;
Message1: TMenuItem;
About1: TMenuItem;
Close1: TMenuItem;
N1: TMenuItem;
cbTray: TCheckBox;
Edit1: TEdit;
Label2: TLabel;
Bevel1: TBevel;
procedure DdhAppExt1Activate(Sender: TObject);
procedure DdhAppExt1Deactivate(Sender: TObject);
procedure Message1Click(Sender: TObject);
procedure About1Click(Sender: TObject);
procedure Close1Click(Sender: TObject);
procedure cbTrayClick(Sender: TObject);
procedure Edit1Change(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.DdhAppExt1Activate(Sender: TObject);
begin
Label1.Caption := 'Active Application';
Label1.Font.Color := clGreen;
end;
procedure TForm1.DdhAppExt1Deactivate(Sender: TObject);
begin
Label1.Caption := 'Inactive Application';
Label1.Font.Color := clRed;
end;
procedure TForm1.Message1Click(Sender: TObject);
begin
ShowMessage ('Place your message here');
end;
procedure TForm1.About1Click(Sender: TObject);
begin
ShowMessage ('DdhAppExt component demo');
end;
procedure TForm1.Close1Click(Sender: TObject);
begin
Close;
end;
procedure TForm1.cbTrayClick(Sender: TObject);
begin
DdhAppExt1.TrayIconActive := cbTray.Checked;
end;
procedure TForm1.Edit1Change(Sender: TObject);
begin
DdhAppExt1.TrayHint := Edit1.Text;
end;
end.
|
Загрузить весь проект
|