unit Unit4;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus;
type
TForm4 = class(TForm)
MainMenu1: TMainMenu;
qwn: TMenuItem;
S1: TMenuItem;
A1: TMenuItem;
N1: TMenuItem;
E1: TMenuItem;
E2: TMenuItem;
H1: TMenuItem;
O1: TMenuItem;
C1: TMenuItem;
T1: TMenuItem;
P1: TMenuItem;
procedure P1DrawItem(Sender: TObject; ACanvas: TCanvas; ARect: TRect;
Selected: Boolean);
procedure T1DrawItem(Sender: TObject; ACanvas: TCanvas; ARect: TRect;
Selected: Boolean);
procedure C1DrawItem(Sender: TObject; ACanvas: TCanvas; ARect: TRect;
Selected: Boolean);
procedure E1DrawItem(Sender: TObject; ACanvas: TCanvas; ARect: TRect;
Selected: Boolean);
procedure A1DrawItem(Sender: TObject; ACanvas: TCanvas; ARect: TRect;
Selected: Boolean);
procedure S1DrawItem(Sender: TObject; ACanvas: TCanvas; ARect: TRect;
Selected: Boolean);
procedure O1DrawItem(Sender: TObject; ACanvas: TCanvas; ARect: TRect;
Selected: Boolean);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form4: TForm4;
implementation
{$R *.dfm}
procedure TForm4.O1DrawItem(Sender: TObject; ACanvas: TCanvas; ARect: TRect;
Selected: Boolean);
begin
ACanvas.Brush.Color:=clRed;
ACanvas.TextFlags:=ETO_OPAQUE;
ACanvas.Rectangle(ARect.Left,ARect.Top,ARect.Left+ACanvas.TextExtent('打开(O) Ctrl+O').cx,
ARect.Top+ACanvas.TextExtent('打开(O) Ctrl+O').cy);
ACanvas.TextOut(ARect.Left+1,ARect.Top+1,'打开(O) Ctrl+O');
end;
procedure TForm4.S1DrawItem(Sender: TObject; ACanvas: TCanvas; ARect: TRect;
Selected: Boolean);
begin
//********
ACanvas.Brush.Color:=clAqua;
ACanvas.TextFlags:=ETO_OPAQUE;
ACanvas.Rectangle(ARect.Left,ARect.Top,ARect.Left+ACanvas.TextExtent('保存(S) Ctrl+S').cx,
ARect.Top+ACanvas.TextExtent('保存(S) Ctrl+S').cy);
ACanvas.TextOut(ARect.Left+1,ARect.Top+1,'保存(S) Ctrl+S');
end;
procedure TForm4.A1DrawItem(Sender: TObject; ACanvas: TCanvas; ARect: TRect;
Selected: Boolean);
begin
//*************
ACanvas.Brush.Color:=clBlue;
ACanvas.TextFlags:=ETO_OPAQUE;
ACanvas.Rectangle(ARect.Left,ARect.Top,ARect.Left+ACanvas.TextExtent('另存为(A)....').cx,
ARect.Top+ACanvas.TextExtent('另存为(A)....').cy);
ACanvas.TextOut(ARect.Left+1,ARect.Top+1,'另存为(A)....');
end;
procedure TForm4.E1DrawItem(Sender: TObject; ACanvas: TCanvas; ARect: TRect;
Selected: Boolean);
begin
//***********
ACanvas.Brush.Color:=clFuchsia;
ACanvas.TextFlags:=ETO_OPAQUE;
ACanvas.Rectangle(ARect.Left,ARect.Top,ARect.Left+ACanvas.TextExtent('退出(E)....').cx,
ARect.Top+ACanvas.TextExtent('退出(E)....').cy);
ACanvas.TextOut(ARect.Left+1,ARect.Top+1,'退出(E)....');
end;
procedure TForm4.C1DrawItem(Sender: TObject; ACanvas: TCanvas; ARect: TRect;
Selected: Boolean);
begin
//*******copy
ACanvas.Brush.Color:=clGreen;
ACanvas.TextFlags:=ETO_OPAQUE;
ACanvas.Rectangle(ARect.Left,ARect.Top,ARect.Left+ACanvas.TextExtent('复制(C) Ctrl+C').cx,
ARect.Top+ACanvas.TextExtent('复制(C) Ctrl+C').cy);
ACanvas.TextOut(ARect.Left+1,ARect.Top+1,'复制(C) Ctrl+C');
end;
procedure TForm4.T1DrawItem(Sender: TObject; ACanvas: TCanvas; ARect: TRect;
Selected: Boolean);
begin
//*****cut
ACanvas.Brush.Color:=clGray;
ACanvas.TextFlags:=ETO_OPAQUE;
ACanvas.Rectangle(ARect.Left,ARect.Top,ARect.Left+ACanvas.TextExtent('剪切(T) Ctrl+X').cx,
ARect.Top+ACanvas.TextExtent('剪切(T) Ctrl+X').cy);
ACanvas.TextOut(ARect.Left+1,ARect.Top+1,'剪切(T) Ctrl+X');
end;
procedure TForm4.P1DrawItem(Sender: TObject; ACanvas: TCanvas; ARect: TRect;
Selected: Boolean);
begin
//** paste...
ACanvas.Brush.Color:=clRed;
ACanvas.TextFlags:=ETO_OPAQUE;
ACanvas.Rectangle(ARect.Left,ARect.Top,ARect.Left+ACanvas.TextExtent('粘贴(P) Ctrl+P').cx,
ARect.Top+ACanvas.TextExtent('粘贴(P) Ctrl+P').cy);
ACanvas.TextOut(ARect.Left+1,ARect.Top+1,'粘贴(P) Ctrl+P');
end;
end.