|
; 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;
//设置Canvas的画笔填充模式为透明
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
//在OnMeasureItem事件中改变菜单的宽度和高度,下面5个程序同
//改变菜单的宽度和高度以容纳文本
Height:=ACanvas.TextHeight(''''Caption1'''')+5;
Width:=ACanvas.TextWidth(''''Caption1'''')+5;
iRate:=Round(Image1.Height/(Height*6));
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'''')+5;
iRate:=Round(Image1.Height/(Height*6));
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*6));
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*6));
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*6));
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*6));
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,''''Caption1'''');
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'''');
上一页 [1] [2] [3] 下一页 [系统软件]windows下Apache+php+mysql的安装与配置图解 [操作系统]在Windows中玩转Linux操作系统 [操作系统]死马还当活马医:6种方法挽救Windows系统 [聊天工具]四大更新 Windows Live Msn 8.1评测 [聊天工具]Windows Live Messenger最新0683版亮相_联络工具_… [聊天工具]Windows Live Mail招人爱的N个理由_联络工具_Wind… [聊天工具]Windows Live Mail Desktop多图欣赏_联络工具_Win… [聊天工具]OE老了 微软开发新邮件客户端取而代之_联络工具 [聊天工具]Windows Live Messenger中文版试用报告(一)__天极… [聊天工具]Windows Live Messenger 8 Beta1高清图赏__天极Ye…
|