Well of course it would, its the width from the start to the start of the text.
GetSystemMetrics(SM_CXMENUCHECK) reports the width of the check mark which is smaller than the small button size.
You need to build the Rectangle based on these values.
So if you take the first value I gave you and DIV 2 that gives you the center mark of the check mark, then take the Second value MENUCHECK and use that div 2 as the +/- position of that center and that will give you the check mark target. At Least it works out that way..
I'll see If I can work out the math for that one too...
Like I said, there is no sure bet this is correct but it seems to work out with my windows 10 this way.
procedure TForm1.CheckListBox1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
Var
R:Trect;
begin
With TCheckListBox(Sender) do
begin
R := ItemRect(0);
Inc(R.Left, GetSystemMetrics(SM_CXSMSIZE) DiV 2);
R.Right := R.Left;
InflateRect(R, GetSystemMetrics(SM_CXMENUCHECK) Div 2,0);
if PtInRect(R, Point(X,Y)) then Beep;
end;
end;
Now if you want vertical narrowing then follow the example here for the horizontal but use
SM_CY... instead when fetching values.
As for the other targets, maybe the checkWidth works there and its also possible the API call I used here is also supported there in the LCLintf.