2

如何在 PopupMenuItem 上绘制复选标记?

我试过这个:

var
  iLeftPos: Integer;
  iTopPos: Integer;
  iText: string;
  iState: integer;
  iGlyphRect: TRect;
begin
   iTopPos := ARect.Top + (ARect.Bottom - ARect.Top -
    ACanvas.TextHeight('W')) div 2;

   { Draw checkmark }
   iGlyphRect := Rect(0, iTopPos, 20, iTopPos + 20);
   if Touch2.Checked then
   begin
     iState := iState or DFCS_MENUCHECK;
     DrawFrameControl(ACanvas.handle, iGlyphRect, DFC_POPUPMENU, iState);
   end;
end;

但它画了这个: 在此处输入图像描述

4

1 回答 1

0

这解决了问题。谢谢特拉玛。

if Touch2.Checked then
begin
  iState := iState or DFCS_MENUCHECK;
  DrawFrameControl(ACanvas.handle, iGlyphRect, DFC_MENU, iState);
end;

在此处输入图像描述

于 2013-10-08T19:00:21.903 回答