呵呵,实际上就是WM_DRAWITEM 看这里:(是在Controls.pas里) procedure TWinControl.WMDrawItem(var Message: TWMDrawItem); begin if not DoControlMsg(Message.DrawItemStruct^.CtlID, Message) then inherited; end;function DoControlMsg(ControlHandle: HWnd; var Message): Boolean; var Control: TWinControl; begin DoControlMsg := False; Control := FindControl(ControlHandle); if Control <> nil then with TMessage(Message) do begin Result := Control.Perform(Msg + CN_BASE, WParam, LParam);//注意这里,是Msg+CN_BASE,也就是WM_DRAWITE+CN_BASE DoControlMsg := True; end; end;
看这里:(是在Controls.pas里)
procedure TWinControl.WMDrawItem(var Message: TWMDrawItem);
begin
if not DoControlMsg(Message.DrawItemStruct^.CtlID, Message) then inherited;
end;function DoControlMsg(ControlHandle: HWnd; var Message): Boolean;
var
Control: TWinControl;
begin
DoControlMsg := False;
Control := FindControl(ControlHandle);
if Control <> nil then
with TMessage(Message) do
begin
Result := Control.Perform(Msg + CN_BASE, WParam, LParam);//注意这里,是Msg+CN_BASE,也就是WM_DRAWITE+CN_BASE
DoControlMsg := True;
end;
end;