| SetRect(TextRect, ARect.Left+24, ARect.Top+3, ARect.Right, ARect.Bottom); DrawText(ACanvas.Handle, PChar(str), Length(str), TextRect, DT_LEFT); str := ShortCutToText(TMenuItem(Sender).ShortCut); SetRect(TextRect, ARect.Left+24, ARect.Top+3, ARect.Right-10, ARect.Bottom); DrawText(ACanvas.Handle, PChar(str), Length(str), TextRect, DT_RIGHT); // if TMenuItem(Sender).Checked then begin ACanvas.Font.Charset := DEFAULT_CHARSET; ACanvas.Font.Name := 'Webdings'; if TMenuItem(Sender).RadioItem then ACanvas.TextOut(ARect.Left+4, ARect.Top, '=') else begin ACanvas.Font.Height := -16; ACanvas.TextOut(ARect.Left+2, ARect.Top, 'a'); end; end; end; //绘制图片 ImageList := TMenuItem(Sender).GetImageList; if ImageList<>nil then if (odSelected in State) and not(odGrayed in State) then ImageList.Draw(ACanvas, ARect.left+2, ARect.Top+2, TMenuItem(Sender).ImageIndex) else ImageList.Draw(ACanvas, ARect.left+3, ARect.Top+3, TMenuItem(Sender).ImageIndex, TMenuItem(Sender).Enabled); end; |