如题,谢谢!
解决方案 »
- delphi读取xml?
- 利用递归删除文件夹,如果文件过多的话,会出现假死。
- 我想做一个socket组件,再收到buffer数据后做些拆包封包操作。请帮助。
- locate的模糊查询问题
- 哪里有rave报表开发教程?
- 源代码编辑器的问题?????
- 在ActiveForm中能读取文本文件的数据吗?
- 高手帮助:在线程中用ADO连接数据库的困惑~~~~
- 那里有压缩和加密解密的控件或者代码!谢谢了!
- cobi(我是小新,我只有5岁)你好,你有打印预览的例子吧,给我发一个好吗
- 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.//供参考