TgeAction = class(Tpanel)
{:TgeAction 为所有行为类的祖先,定义了一些与业务无关的属性,此控件具有自己的度量单位,procedure TgeAction.wmMouseUp(var msg: TWMMouse);
{:设置blDown属性和cursor属性值}
var
AMouseUP:TMouseEvent;
ButtonD:TMouseButton;
sShift:TShiftstate;
begin
blDown:=False;
cursor:=crDefault;
ReleaseCapture();
AMouseUp:=OnMouseUp;
if assigned(AMouseUp) then
begin
sShift:=[ssLeft];
if Msg.Keys=MK_LButton then
ButtonD:=mbLeft
else if msg.Keys=MK_RBUTTON then
buttonD:=mbRight
else if Msg.Keys=MK_CONTROL then
sShift:=[ssCtrl];
OnMouseUp(Self,ButtonD,sShift,msg.xPos,msg.yPos);
end;
end;由此类派生出来的对象当按下mouse左键时跟踪到wmMouseUp中Msg.keys的值始终为0 不知为什么所以也获得不了正确的mouse 按键,
这是别人写的代码我来改造
{:TgeAction 为所有行为类的祖先,定义了一些与业务无关的属性,此控件具有自己的度量单位,procedure TgeAction.wmMouseUp(var msg: TWMMouse);
{:设置blDown属性和cursor属性值}
var
AMouseUP:TMouseEvent;
ButtonD:TMouseButton;
sShift:TShiftstate;
begin
blDown:=False;
cursor:=crDefault;
ReleaseCapture();
AMouseUp:=OnMouseUp;
if assigned(AMouseUp) then
begin
sShift:=[ssLeft];
if Msg.Keys=MK_LButton then
ButtonD:=mbLeft
else if msg.Keys=MK_RBUTTON then
buttonD:=mbRight
else if Msg.Keys=MK_CONTROL then
sShift:=[ssCtrl];
OnMouseUp(Self,ButtonD,sShift,msg.xPos,msg.yPos);
end;
end;由此类派生出来的对象当按下mouse左键时跟踪到wmMouseUp中Msg.keys的值始终为0 不知为什么所以也获得不了正确的mouse 按键,
这是别人写的代码我来改造
begin
......
end;