MainMenu1->Items[0].OnDrawItem=...
解决方案 »
- 要使鼠标不能点击dbgrid控件上的记录?如何设置,或者编写?
- 求救:有不少问题:delphi的内部错误:URW3537...
- 散分
- csdn的字太小
- 什么地方能够下载DOA(即Direct Oracle Access的缩写)?(急)
- 请问动态域名解析DDNS如何实现?
- 嘿,好东西,ehlib2.5直接支持点击表头排序!
- 请问那有关于avi文件是如何生成的文章啊???急急急!!!!在线等候!
- 怎么把HTML插入TWebBrowser而不会出现乱码?
- dbgrid中如何自动统计?
- 控件数组问题:如何把N个EDIT.TEXT赋值给数组!!!--在线等待!!
- Delphi控制Excel的问题,如何选择性粘贴-->格式??(特急)
//设置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.
ModifyMeun(MainMenu.Handle,MainMenu.Items[I].Handle,MF_BYPOSITION or MF_BITMAP,Poninter('Bmp1'),'看一看如何?');
ModifyMeun(MainMenu.Handle,MainMenu.Items[I].Handle,MF_BYPOSITION or MF_BITMAP,Poninter('Bmp1'),'看一看如何?');
ModifyMeun(MainMenu.Handle,MainMenu.Items[I].Handle,MF_BYPOSITION or MF_BITMAP,Poninter('Bmp1'),'看一看如何?');