请问这个问什么不对(0分)

  • 主题发起人 主题发起人 amartapple
  • 开始时间 开始时间
A

amartapple

Unregistered / Unconfirmed
GUEST, unregistred user!
那么这个呢?
void __fastcall TForm1::test2DrawItem(TObject *Sender, TCanvas *ACanvas, TRect &ARect, bool Selected)
{
//如果当前的菜单项是选择状态的话。那么将当前菜单项的范围填充为蓝色的。
if(Selected==true)
{
//如果想修改菜单项被选择时的颜色,请改这里。
ACanvas->Brush->Color=clRed;
ACanvas->FillRect(ARect);
}
}
 
给你一段代码试试看:
void __fastcall TForm1::DrawItem(TMenuItem *MenuItem,TCanvas *ACanvas,TRect &DrawRect,bool Selected)
{
TColor BackGround;
if (Selected)
{
ACanvas->Pen->Color = clRed;
BackGround = clBlue;
Screen->Cursor = crHandPoint;
}
else
{
ACanvas->Pen->Color = clBtnFace;
BackGround = clBtnFace;
Screen->Cursor = crDefault;
}
ACanvas->Rectangle(DrawRect);
ACanvas->Brush->Color = BackGround;
ACanvas->FillRect(Rect(DrawRect.Left + 1,DrawRect.Top + 1,DrawRect.Right - 1,DrawRect.Bottom - 1));
ACanvas->Pen->Color = clBlack;
ACanvas->TextOutA(DrawRect.Left + 14,DrawRect.Bottom - 16,MenuItem->Caption);
}
这是前几天写的
 
楼上的不错……[:)]
 

Similar threads

I
回复
0
查看
700
import
I
S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
595
import
I
后退
顶部