문제

Objective: I'm trying to make the first 3 items on a TCheckListBox control appear in bold. lstMenuPermissions is my control.

So I tried this:

procedure TfrmPermissions.lstMenuPermissionsDrawItem(Control: TWinControl;
  Index: Integer; ARect: TRect; State: TOwnerDrawState);
begin      
  if index < 3 Then 
    with (Control as TCheckListBox).Canvas do
      begin
        Font.Bold := True;           
        TextOut(ARect.Left, ARect.Top, (Control as TCheckListBox).Items[Index]);
      end;

end;  

There was no effect so I thought of checking if the event got fired in the first place and I tried this:

procedure TfrmPermissions.lstMenuPermissionsDrawItem(Control: TWinControl;
  Index: Integer; ARect: TRect; State: TOwnerDrawState);
begin
  ShowMessage('OK');
end;  

I have also set the Style to lbOwnerDrawFixed.

But there is no message box. So I'm guessing that the event is not firing. Maybe I'm doing something wrong. Please advise on how I should get about this.

Thanks!

올바른 솔루션이 없습니다

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top