📄 unit1.pas
字号:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
xpWindow, ComCtrls, StdCtrls, xpGroupBox, xpCombo, xpPages, xpButton,
xpCheckBox, Menus, ExtCtrls, xpPanel;
type
TForm1 = class(TForm)
xpWindow1: TxpWindow;
xpGroupBox1: TxpGroupBox;
ImageList1: TImageList;
xpComboBox1: TxpComboBox;
ImageList2: TImageList;
xpCheckBox2: TxpCheckBox;
xpCheckBox1: TxpCheckBox;
procedure xpWindow1CustomButtonDraw(Sender: TObject; ACanvas: TCanvas;
AButtonRect: TRect; AButtonIndex: Integer;
AState: TTitleButtonState);
procedure xpWindow1CustomButtonClick(Sender: TObject;
AButtonIndex: Integer);
procedure xpComboBox1Change(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure xpWindow1CustomSysBtnDraw(Sender: TObject; ACanvas: TCanvas;
AButtonRect: TRect; AButtonIndex: Integer;
AState: TTitleButtonState);
procedure xpCheckBox2Click(Sender: TObject);
procedure xpCheckBox1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
xpGroupBox : TxpGroupBox;
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
{$R WINDOWSXP.RES}
uses
xpGraphUtil, xpCtrlStyle;
procedure TForm1.xpWindow1CustomButtonDraw(Sender: TObject;
ACanvas: TCanvas; AButtonRect: TRect; AButtonIndex: Integer;
AState: TTitleButtonState);
begin
ImageList1.Draw (ACanvas, AButtonRect.Left+1, AButtonRect.Top+1, Integer (AState));
ACanvas.Pen.Color := clWhite;
ACanvas.Brush.Style := bsClear;
ACanvas.RoundRect (AButtonRect.Left, AButtonRect.Top, AButtonRect.Right, AButtonRect.Bottom, 2, 2);
end;
procedure TForm1.xpWindow1CustomButtonClick(Sender: TObject;
AButtonIndex: Integer);
begin
ShowMessageFmt ('Custom button %d clicked', [AButtonIndex]);
end;
procedure TForm1.xpComboBox1Change(Sender: TObject);
begin
if (Sender as TCOmboBox).ItemIndex = 0 then
xpWindow1.xpCaption.Active := False
else
xpWindow1.Style := TxpWindowStyle((Sender as TComboBox).ItemIndex);
xpWindow1.WinBackground.Active := ((Sender as TComboBox).ItemIndex = 4);
xpCheckBox1.Checked := False;
xpCheckBox2.Checked := False;
xpCheckBox1Click (xpCheckBox1);
xpCheckBox2Click (xpCheckBox2);
xpCheckBox1.Enabled := ((Sender as TCOmboBox).ItemIndex <> 0);
xpCheckBox2.Enabled := ((Sender as TCOmboBox).ItemIndex <> 0);
xpWindow1.ApplyStyleColors (xpWindow1.Style);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
xpComboBox1.ItemIndex := 1;
//Width := 232;
Height := 220;
end;
procedure TForm1.xpWindow1CustomSysBtnDraw(Sender: TObject;
ACanvas: TCanvas; AButtonRect: TRect; AButtonIndex: Integer;
AState: TTitleButtonState);
begin
case AState of
tbsNormal: ImageList2.Draw (ACanvas, AButtonRect.Left, AButtonRect.Top, 2 + (AButtonIndex - 1) * 3);
tbsActive: ImageList2.Draw (ACanvas, AButtonRect.Left, AButtonRect.Top, 1 + (AButtonIndex - 1) * 3);
tbsDowned: ImageList2.Draw (ACanvas, AButtonRect.Left, AButtonRect.Top, 0 + (AButtonIndex - 1) * 3);
end;
end;
procedure TForm1.xpCheckBox2Click(Sender: TObject);
begin
if xpCheckBox2.Checked then
xpWindow1.OnCustomSysBtnDraw := xpWindow1CustomSysBtnDraw
else
xpWindow1.OnCustomSysBtnDraw := nil;
xpWindow1.ForceReDraw;
end;
procedure TForm1.xpCheckBox1Click(Sender: TObject);
begin
xpWindow1.xpCaption.CustomButtonCount := Integer ((Sender as TxpCheckBox).Checked);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -