📄 controlcenter.~pas
字号:
unit ControlCenter;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
base, StdCtrls, ExtCtrls, jpeg, OleCtrls, SHDocVw, Buttons, ComCtrls,
CheckLst,adodb, Menus;
type
TFrm_ControlCenter = class(TFrm_Base)
pnlLeft: TPanel;
pnlRight: TPanel;
imgFlag: TImage;
pnlItem1: TPanel;
pnlItem2: TPanel;
pnlItem3: TPanel;
pnlItem4: TPanel;
pnlItem5: TPanel;
pnlItem6: TPanel;
pnlMiddle: TPanel;
pgcControl: TPageControl;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
TabSheet3: TTabSheet;
TabSheet4: TTabSheet;
TabSheet5: TTabSheet;
TabSheet6: TTabSheet;
Image1: TImage;
imgTitle: TImage;
Label1: TLabel;
Panel1: TPanel;
TabSheet7: TTabSheet;
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
SpeedButton3: TSpeedButton;
SpeedButton4: TSpeedButton;
chkAutoAlarm: TCheckBox;
Label13: TLabel;
Label11: TLabel;
Image11: TImage;
Label14: TLabel;
Label12: TLabel;
Image12: TImage;
Image13: TImage;
Image14: TImage;
stValue1: TStaticText;
stValue2: TStaticText;
stValue3: TStaticText;
stValue4: TStaticText;
stValue4_2: TStaticText;
SpeedButton6: TSpeedButton;
SpeedButton7: TSpeedButton;
SpeedButton8: TSpeedButton;
SpeedButton9: TSpeedButton;
SpeedButton10: TSpeedButton;
SpeedButton11: TSpeedButton;
SpeedButton12: TSpeedButton;
SpeedButton13: TSpeedButton;
SpeedButton14: TSpeedButton;
SpeedButton15: TSpeedButton;
SpeedButton16: TSpeedButton;
SpeedButton17: TSpeedButton;
SpeedButton20: TSpeedButton;
SpeedButton18: TSpeedButton;
SpeedButton19: TSpeedButton;
SpeedButton21: TSpeedButton;
SpeedButton22: TSpeedButton;
SpeedButton23: TSpeedButton;
SpeedButton24: TSpeedButton;
SpeedButton25: TSpeedButton;
SpeedButton26: TSpeedButton;
SpeedButton5: TSpeedButton;
SpeedButton27: TSpeedButton;
SpeedButton28: TSpeedButton;
SpeedButton29: TSpeedButton;
SpeedButton30: TSpeedButton;
SpeedButton31: TSpeedButton;
SpeedButton32: TSpeedButton;
SpeedButton33: TSpeedButton;
SpeedButton34: TSpeedButton;
SpeedButton35: TSpeedButton;
SpeedButton36: TSpeedButton;
SpeedButton37: TSpeedButton;
procedure FormActivate(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure pnlItem1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure pnlItem1Click(Sender: TObject);
procedure pnlLeftMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure FormResize(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
ADOQ_Temp:TADOQuery;
//
KSelectedIndex :integer;
KLinkIndex :integer;
//
WinWidth,WinHeight :integer;
public
{ Public declarations }
end;
var
Frm_ControlCenter: TFrm_ControlCenter;
Const
StandColor:TColor=clNavy;
LinkColor:TColor=$00EA7500;
hoverColor:TColor=$00EA7500;
KItemCount:integer=6;
implementation
uses common, Main, DataBase;
{$R *.DFM}
procedure TFrm_ControlCenter.FormActivate(Sender: TObject);
begin
// inherited;
end;
procedure TFrm_ControlCenter.FormCreate(Sender: TObject);
begin
// inherited;
{ SetWindowLong(Handle, GWL_STYLE,
GetWindowLong(Handle,GWL_STYLE) AND
NOT WS_CAPTION);
//ClientHeight := Height;
Refresh;
}
//
WinWidth :=Self.Width;
WinHeight :=Self.Height;
//
ADOQ_Temp :=TADOQUERY.Create(self);
ADOQ_Temp.Connection :=DataModule1.ADOConnection1;
end;
procedure TFrm_ControlCenter.pnlItem1MouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
var
i,j:integer;
begin
inherited;
if KLinkIndex=(Sender as TPanel).Tag then exit;
// 取消所有(未选中项)加亮项
for i:=1 to KItemCount do
begin
if i<>KSelectedIndex then
begin
for j:=0 to Self.ComponentCount-1 do
begin
if (Self.Components[j] is TPanel) and ( (Self.Components[j] as TPanel).Tag= i ) then
begin
(Self.Components[j] as TPanel).Color :=StandColor;
end;
end;
end;
end;
// 加亮当前项
if (Sender as TPanel).Tag=KSelectedIndex then // 若当前项已被选中
begin
(Sender as TPanel).Color :=hoverColor;
end else
begin
(Sender as TPanel).Color :=LinkColor; // 若当前项未被选中
end;
end;
procedure TFrm_ControlCenter.pnlItem1Click(Sender: TObject);
begin
inherited;
//
KSelectedIndex:=(Sender as TPanel).Tag;
//
(Sender as TPanel).Color :=hoverColor;
//
pgcControl.ActivePageIndex := KSelectedIndex-1;
end;
procedure TFrm_ControlCenter.pnlLeftMouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
var
i,j:integer;
begin
inherited;
if KLinkIndex=0 then exit;
// 取消所有(未选中项)加亮项
for i:=1 to KItemCount do
begin
if i<>KSelectedIndex then
begin
for j:=0 to Self.ComponentCount-1 do
begin
if (Self.Components[j] is TPanel) and ( (Self.Components[j] as TPanel).Tag= i ) then
begin
(Self.Components[j] as TPanel).Color :=StandColor;
end;
end;
end;
end;
end;
procedure TFrm_ControlCenter.FormResize(Sender: TObject);
begin
inherited;
Self.Width :=WinWidth;
Self.Height :=WinHeight;
end;
procedure TFrm_ControlCenter.FormShow(Sender: TObject);
begin
inherited;
if gs_Set_AutoAlarm='1' then
begin
pgcControl.ActivePageIndex := 6;
end else
begin
pgcControl.ActivePageIndex := 0;
end;
end;
procedure TFrm_ControlCenter.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
inherited;
ADOQ_Temp.Close;
ADOQ_Temp:=nil;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -