简单到极致

自定义popupmenu菜单背景色

procedure TForm1.N11DrawItem(Sender: TObject; ACanvas: TCanvas; ARect: TRect;

  Selected: Boolean);

begin

 If (Selected) Then

 begin

 

 

 ACanvas.Font.Color := clWhite  ;

  ACanvas.Brush.Color := clWebDodgerBlue;

      ACanvas.FillRect(ARect);

         DrawText(ACanvas.Handle, PChar('   取消开机启动'), -1, ARect, DT_LEFT Or DT_LEFT Or DT_SINGLELINE Or DT_NOCLIP);

 end

  Else

  begin

  ACanvas.Font.Color := clblack;

 

    ACanvas.Brush.Color := clWebSnow;

    ACanvas.FillRect(ARect);

 

    DrawText(ACanvas.Handle, PChar('   取消开机启动'), -1, ARect, DT_LEFT Or DT_LEFT  Or DT_SINGLELINE Or DT_NOCLIP);

  end;

end;

posted @ 2014-05-07 06:57  ring_hacker  阅读(2416)  评论(0编辑  收藏  举报