如题,谢谢!
解决方案 »
- delphi实现依次运行指定目录下的所有文件...
- 对10到30位的数字进行加密,加密后还是数字,一个加密算法,一个解密算法,两个算法都不同,怎么写???
- delphi中向ACCESS添加图片遇到问师了.50大洋呀.
- 关于用midas.dll来实现广域网数据库时出现的一些问题,大家来讨论一下!!
- 关于线程的问题,进者有分,解决立刻200分了!!!
- delphi可以从网卡,或串口得到数据吗
- 谁有ANIMATEIMAGE控件。
- Win2000与Win98字体的问题
- 如何在delphi调用htmlhelp做的帮助文件?
- DBGRID怎样设置其中的一个单元格值?(不要通过改DataSet属性,要类似于Stringgird的Cells[col,row]方法改,如何做?)
- FastReport 急求!在线等候!
- 如何使用odac控件获取oracle数据库中的所有表的名称!或者如何获取数据库中所有表名?
然后在菜单项的MeasureItem事件进行控制
ARect: TRect; Selected: Boolean);
begin
acanvas.Font.Color:=clred;
if selected then
SetBkColor(acanvas.handle,clgreen)
else
setBkcolor(acanvas.handle,clblue);
acanvas.TextRect(arect,0,0,new1.caption);
end;// Kingron的源代码^^^
//设置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');end; procedure TForm1.Caption6DrawItem(Sender: TObject; ACanvas: TCanvas; ARect: TRect; Selected: Boolean);begin DrawItem(TMenuItem(Sender),ACanvas,ARect,Selected,'Caption6');end; end.//供参考