很久以前的一个东东,写的很乱,你留下mail,给你 E 过去。
----------
源码:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Menus, jpeg, ExtCtrls, StdCtrls, Buttons;
type
TForm1 = class(TForm)
MainMenu1: TMainMenu;
main1: TMenuItem;
caption1: TMenuItem;
caption2: TMenuItem;
caption3: TMenuItem;
caption4: TMenuItem;
caption5: TMenuItem;
caption6: TMenuItem;
Image1: TImage;
caption61: TMenuItem;
caption81: TMenuItem;
caption62: TMenuItem;
caption63: TMenuItem;
caption64: TMenuItem;
caption65: TMenuItem;
caption66: TMenuItem;
procedure caption1MeasureItem(Sender: TObject; ACanvas: TCanvas;
var Width, Height: Integer);
procedure caption2MeasureItem(Sender: TObject; ACanvas: TCanvas;
var Width, Height: Integer);
procedure caption3MeasureItem(Sender: TObject; ACanvas: TCanvas;
var Width, Height: Integer);
procedure caption4MeasureItem(Sender: TObject; ACanvas: TCanvas;
var Width, Height: Integer);
procedure caption5MeasureItem(Sender: TObject; ACanvas: TCanvas;
var Width, Height: Integer);
procedure caption6MeasureItem(Sender: TObject; ACanvas: TCanvas;
var Width, Height: Integer);
procedure caption1DrawItem(Sender: TObject; ACanvas: TCanvas;
ARect: TRect; Selected: Boolean);
procedure caption2DrawItem(Sender: TObject; ACanvas: TCanvas;
ARect: TRect; Selected: Boolean);
procedure caption3DrawItem(Sender: TObject; ACanvas: TCanvas;
ARect: TRect; Selected: Boolean);
procedure caption4DrawItem(Sender: TObject; ACanvas: TCanvas;
ARect: TRect; Selected: Boolean);
procedure caption5DrawItem(Sender: TObject; ACanvas: TCanvas;
ARect: TRect; Selected: Boolean);
procedure caption6DrawItem(Sender: TObject; ACanvas: TCanvas;
ARect: TRect; Selected: Boolean);
procedure caption61DrawItem(Sender: TObject; ACanvas: TCanvas;
ARect: TRect; Selected: Boolean);
procedure caption81DrawItem(Sender: TObject; ACanvas: TCanvas;
ARect: TRect; Selected: Boolean);
procedure caption62DrawItem(Sender: TObject; ACanvas: TCanvas;
ARect: TRect; Selected: Boolean);
procedure caption64DrawItem(Sender: TObject; ACanvas: TCanvas;
ARect: TRect; Selected: Boolean);
procedure caption63DrawItem(Sender: TObject; ACanvas: TCanvas;
ARect: TRect; Selected: Boolean);
procedure caption66DrawItem(Sender: TObject; ACanvas: TCanvas;
ARect: TRect; Selected: Boolean);
procedure caption65DrawItem(Sender: TObject; ACanvas: TCanvas;
ARect: TRect; Selected: Boolean);
procedure caption61MeasureItem(Sender: TObject; ACanvas: TCanvas;
var Width, Height: Integer);
procedure caption81MeasureItem(Sender: TObject; ACanvas: TCanvas;
var Width, Height: Integer);
procedure caption62MeasureItem(Sender: TObject; ACanvas: TCanvas;
var Width, Height: Integer);
procedure caption64MeasureItem(Sender: TObject; ACanvas: TCanvas;
var Width, Height: Integer);
procedure caption63MeasureItem(Sender: TObject; ACanvas: TCanvas;
var Width, Height: Integer);
procedure caption66MeasureItem(Sender: TObject; ACanvas: TCanvas;
var Width, Height: Integer);
procedure caption65MeasureItem(Sender: TObject; ACanvas: TCanvas;
var Width, Height: Integer);
private
{ Private declarations }
public
procedure DrawItem(Sender: TMenuItem; ACanvas: TCanvas;
ARect: TRect; Selected: Boolean;StrOut:String);
{ Public declarations }
end;
var
Form1: TForm1;
i,ih,ind,iw,irate:integer;
rtemp:trect;
ig1,ig2:integer;
implementation
{$R *.DFM}
procedure TForm1.DrawItem(Sender: TMenuItem; ACanvas: TCanvas;
ARect: TRect; Selected: Boolean;StrOut:String);
var j:integer;
begin
i:=arect.Bottom-arect.Top;
ind:=sender.MenuIndex;
ih:=round(image1.Height/13*ind);
stretchBlt(acanvas.Handle,arect.Left,arect.Top,iw,i,image1.Canvas.Handle,0,ih,image1.Width,round(image1.Height/13),srccopy);
if selected then
begin
acanvas.Font.Color:=clwhite;
rtemp:=arect;
rtemp.Left:=rtemp.Left+iw;
ig1:=round((rtemp.Right-rtemp.Left)/10);
rtemp.Right:=rtemp.Left+ig1;
for j:=0 to 9 do
begin
acanvas.Brush.Color:=rgb(0,0,j*25);
acanvas.FillRect(rtemp);
rtemp.Left:=rtemp.Left+ig1;
rtemp.Right:=rtemp.Left+ig1;
end;
end
else
begin
acanvas.Brush.Color:=cl3dlight;
rtemp:=arect;
rtemp.Left:=rtemp.Left+iw;
acanvas.FillRect(rtemp);
acanvas.Font.Color:=clblack;
end;
acanvas.Brush.Style:=bsclear;
acanvas.TextOut(arect.Left+iw+5,arect.Top,strout);
end;
procedure TForm1.caption1MeasureItem(Sender: TObject; ACanvas: TCanvas;
var Width, Height: Integer);
begin
height:=acanvas.TextHeight('caption1')+5;
width:=acanvas.TextWidth('caption1')+50;
irate:=round(image1.height/(height*13));
iw:=round(image1.width/irate);
width:=width+iw;
end;
procedure TForm1.caption2MeasureItem(Sender: TObject; ACanvas: TCanvas;
var Width, Height: Integer);
begin
height:=acanvas.TextHeight('caption1')+5;
width:=acanvas.TextWidth('caption1')+50;
irate:=round(image1.height/(height*13));
iw:=round(image1.width/irate);
width:=width+iw;
end;
procedure TForm1.caption3MeasureItem(Sender: TObject; ACanvas: TCanvas;
var Width, Height: Integer);
begin
height:=acanvas.TextHeight('caption1')+5;
width:=acanvas.TextWidth('caption1')+5;
irate:=round(image1.height/(height*13));
iw:=round(image1.width/irate);
width:=width+iw;
end;
procedure TForm1.caption4MeasureItem(Sender: TObject; ACanvas: TCanvas;
var Width, Height: Integer);
begin
height:=acanvas.TextHeight('caption1')+5;
width:=acanvas.TextWidth('caption1')+5;
irate:=round(image1.height/(height*13));
iw:=round(image1.width/irate);
width:=width+iw;
end;
procedure TForm1.caption5MeasureItem(Sender: TObject; ACanvas: TCanvas;
var Width, Height: Integer);
begin
height:=acanvas.TextHeight('caption1')+5;
width:=acanvas.TextWidth('caption1')+5;
irate:=round(image1.height/(height*13));
iw:=round(image1.width/irate);
width:=width+iw;
end;
procedure TForm1.caption6MeasureItem(Sender: TObject; ACanvas: TCanvas;
var Width, Height: Integer);
begin
height:=acanvas.TextHeight('caption1')+5;
width:=acanvas.TextWidth('caption1')+5;
irate:=round(image1.height/(height*13));
iw:=round(image1.width/irate);
width:=width+iw;
end;
procedure TForm1.caption1DrawItem(Sender: TObject; ACanvas: TCanvas;
ARect: TRect; Selected: Boolean);
begin
DrawItem(TMenuItem(Sender),ACanvas,ARect,Selected,'234643623562346');
end;
procedure TForm1.caption2DrawItem(Sender: TObject; ACanvas: TCanvas;
ARect: TRect; Selected: Boolean);
begin
DrawItem(TMenuItem(Sender),ACanvas,ARect,Selected,'Caption2');
end;
procedure TForm1.caption3DrawItem(Sender: TObject; ACanvas: TCanvas;
ARect: TRect; Selected: Boolean);
begin
DrawItem(TMenuItem(Sender),ACanvas,ARect,Selected,'Caption3');
end;
procedure TForm1.caption4DrawItem(Sender: TObject; ACanvas: TCanvas;
ARect: TRect; Selected: Boolean);
begin
DrawItem(TMenuItem(Sender),ACanvas,ARect,Selected,'Caption4');
end;
procedure TForm1.caption5DrawItem(Sender: TObject; ACanvas: TCanvas;
ARect: TRect; Selected: Boolean);
begin
DrawItem(TMenuItem(Sender),ACanvas,ARect,Selected,'Caption5');
end;
procedure TForm1.caption6DrawItem(Sender: TObject; ACanvas: TCanvas;
ARect: TRect; Selected: Boolean);
begin
DrawItem(TMenuItem(Sender),ACanvas,ARect,Selected,'Caption6');
end;
procedure TForm1.caption61DrawItem(Sender: TObject; ACanvas: TCanvas;
ARect: TRect; Selected: Boolean);
begin
DrawItem(TMenuItem(Sender),ACanvas,ARect,Selected,'Caption7');
end;
procedure TForm1.caption81DrawItem(Sender: TObject; ACanvas: TCanvas;
ARect: TRect; Selected: Boolean);
begin
DrawItem(TMenuItem(Sender),ACanvas,ARect,Selected,'Caption8');
end;
procedure TForm1.caption62DrawItem(Sender: TObject; ACanvas: TCanvas;
ARect: TRect; Selected: Boolean);
begin
DrawItem(TMenuItem(Sender),ACanvas,ARect,Selected,'Caption9');
end;
procedure TForm1.caption64DrawItem(Sender: TObject; ACanvas: TCanvas;
ARect: TRect; Selected: Boolean);
begin
DrawItem(TMenuItem(Sender),ACanvas,ARect,Selected,'Caption10');
end;
procedure TForm1.caption63DrawItem(Sender: TObject; ACanvas: TCanvas;
ARect: TRect; Selected: Boolean);
begin
DrawItem(TMenuItem(Sender),ACanvas,ARect,Selected,'Caption11');
end;
procedure TForm1.caption66DrawItem(Sender: TObject; ACanvas: TCanvas;
ARect: TRect; Selected: Boolean);
begin
DrawItem(TMenuItem(Sender),ACanvas,ARect,Selected,'Caption12');
end;
procedure TForm1.caption65DrawItem(Sender: TObject; ACanvas: TCanvas;
ARect: TRect; Selected: Boolean);
begin
DrawItem(TMenuItem(Sender),ACanvas,ARect,Selected,'Caption13');
end;
procedure TForm1.caption61MeasureItem(Sender: TObject; ACanvas: TCanvas;
var Width, Height: Integer);
begin
height:=acanvas.TextHeight('caption1')+5;
width:=acanvas.TextWidth('caption1')+5;
irate:=round(image1.height/(height*13));
iw:=round(image1.width/irate);
width:=width+iw;
end;
procedure TForm1.caption81MeasureItem(Sender: TObject; ACanvas: TCanvas;
var Width, Height: Integer);
begin
height:=acanvas.TextHeight('caption1')+5;
width:=acanvas.TextWidth('caption1')+5;
irate:=round(image1.height/(height*13));
iw:=round(image1.width/irate);
width:=width+iw;
end;
procedure TForm1.caption62MeasureItem(Sender: TObject; ACanvas: TCanvas;
var Width, Height: Integer);
begin
height:=acanvas.TextHeight('caption1')+5;
width:=acanvas.TextWidth('caption1')+5;
irate:=round(image1.height/(height*13));
iw:=round(image1.width/irate);
width:=width+iw;
end;
procedure TForm1.caption64MeasureItem(Sender: TObject; ACanvas: TCanvas;
var Width, Height: Integer);
begin
height:=acanvas.TextHeight('caption1')+5;
width:=acanvas.TextWidth('caption1')+5;
irate:=round(image1.height/(height*13));
iw:=round(image1.width/irate);
width:=width+iw;
end;
procedure TForm1.caption63MeasureItem(Sender: TObject; ACanvas: TCanvas;
var Width, Height: Integer);
begin
height:=acanvas.TextHeight('caption1')+5;
width:=acanvas.TextWidth('caption1')+5;
irate:=round(image1.height/(height*13));
iw:=round(image1.width/irate);
width:=width+iw;
end;
procedure TForm1.caption66MeasureItem(Sender: TObject; ACanvas: TCanvas;
var Width, Height: Integer);
begin
height:=acanvas.TextHeight('caption1')+5;
width:=acanvas.TextWidth('caption1')+5;
irate:=round(image1.height/(height*13));
iw:=round(image1.width/irate);
width:=width+iw;
end;
procedure TForm1.caption65MeasureItem(Sender: TObject; ACanvas: TCanvas;
var Width, Height: Integer);
begin
height:=acanvas.TextHeight('caption1')+5;
width:=acanvas.TextWidth('caption1')+5;
irate:=round(image1.height/(height*13));
iw:=round(image1.width/irate);
width:=width+iw;
end;
end.