TCheckListBox
항목 상태를 토글하려고 시도하고 있으므로 항목이 선택되어 있으면 선택 취소하고 반대로 선택하십시오. 이것은 대개 물리적 상자 자체를 클릭 할 때만 전환되지만 사용자가 항목 행의 아무 곳이나 클릭 할 때 전환 할 수 있습니다.CheckListBox 항목을 클릭하여 해당 항목의 체크 상태를 토글합니다.
아래 코드는 작동하지만 항목이 실제 상자에서 클릭 할 때 전환 할 수 없도록합니다 (예 : 현재 선택 해제 된 상태에서 상자를 클릭하면 선택 취소됩니다).
코드에서 두 가지 동작 또는 잘못된 동작을 모두 사용할 수 있습니까?
procedure TMainFrm.CheckListBoxModulesMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
APoint: TPoint;
Index: integer;
begin
if (Button = mbLeft) then
begin
APoint.X := X;
APoint.Y := Y;
Index := CheckListBoxModules.ItemAtPos(APoint, True);
if(Index > -1) then
begin
CheckListBoxModules.Checked[Index] := not CheckListBoxModules.Checked[Index];
end;
end;
end;
'if y> 16 then Begin ... End' – bummi
음, 그런 것 같아요. X가합니다. – ikathegreat