第一步:
procedure TControl.WMLButtonDown(var Message: TWMLButtonDown);
begin
SendCancelMode(Self); //这一步?是取消模态窗口模式吧,我想问下放在这里有什么用?为什么要取消
inherited;
if csCaptureMouse in ControlStyle then //判断1
MouseCapture := True;
if csClickEvents in ControlStyle then //判断2 我查了一下,ControlStyle里面包含了这两个状态为什么这里面还判断是否包含呢?
Include(FControlState, csClicked); //这里面的Include是什么意思?
DoMouseDown(Message, mbLeft, []);
end;
第二步:
procedure TControl.DoMouseDown(var Message: TWMMouse; Button: TMouseButton;
Shift: TShiftState);
begin
if not (csNoStdEvents in ControlStyle) then //还是这个ControlStyle是否在别的地方删除过,这里面也需要判断呢?
with Message do
if (Width > 32768) or (Height > 32768) then
with CalcCursorPos do
MouseDown(Button, KeysToShiftState(Keys) + Shift, X, Y)
else
MouseDown(Button, KeysToShiftState(Keys) + Shift, Message.XPos, Message.YPos);
end;麻烦懂的人,花一点时间帮我解释一下,我真的很想知道,看了一天了,没看明白,谢谢
procedure TControl.WMLButtonDown(var Message: TWMLButtonDown);
begin
SendCancelMode(Self); //这一步?是取消模态窗口模式吧,我想问下放在这里有什么用?为什么要取消
inherited;
if csCaptureMouse in ControlStyle then //判断1
MouseCapture := True;
if csClickEvents in ControlStyle then //判断2 我查了一下,ControlStyle里面包含了这两个状态为什么这里面还判断是否包含呢?
Include(FControlState, csClicked); //这里面的Include是什么意思?
DoMouseDown(Message, mbLeft, []);
end;
第二步:
procedure TControl.DoMouseDown(var Message: TWMMouse; Button: TMouseButton;
Shift: TShiftState);
begin
if not (csNoStdEvents in ControlStyle) then //还是这个ControlStyle是否在别的地方删除过,这里面也需要判断呢?
with Message do
if (Width > 32768) or (Height > 32768) then
with CalcCursorPos do
MouseDown(Button, KeysToShiftState(Keys) + Shift, X, Y)
else
MouseDown(Button, KeysToShiftState(Keys) + Shift, Message.XPos, Message.YPos);
end;麻烦懂的人,花一点时间帮我解释一下,我真的很想知道,看了一天了,没看明白,谢谢
procedure TForm1.FormCreate(Sender: TObject);
begin
GroupBox1.ControlStyle := GroupBox1.ControlStyle - [csClickEvents];
end;