如何所有者在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;


但这是这样的:

最佳答案

这样可以解决问题。谢谢TLama。

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

关于delphi - 如何OwnerDraw PopupMenuItem CheckMark,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/19255596/

10-09 02:19