1)当我们把QQ
主窗体拖到桌面顶部后,放开鼠标,他就会自动
缩上去,鼠标移到他身上时又会重新出现!
请问谁有研究过教我一下吧?
我写了但没有用:
procedure TForm1.CMMouseEnter(var message: TMessage);
begin
{if top=-17 then
begin//2
Height:=65 ;
SetCapture(Handle);
end;//2 // 激活窗口
}
case Message.Msg of
CM_MOUSEENTER:begin
SetCapture(Handle);
if Self.Height <= 0 then
self.Height := 30;
self.Invalidate;
end;
end;
end;procedure TForm1.CMMouseLeave(var Message: TMessage);
//var
// Pt: TPoint;
begin
{GetCursorPos(Pt);
if not PtInRect(Bounds(Left, Top, Width, Height), Pt)
then // 做此判断为过滤
begin//1
if top=-17 then
begin//2
Height:=1;
ReleaseCapture;
end;//2
end;//1
}
case Message.Msg of
CM_MOUSELEAVE: begin if self.Height > 30 then
self.Height := 0;
self.Invalidate;
ReleaseCapture;
end; end;
end;procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if Button= mbLeft then
begin
ReleaseCapture;
SendMessage(Handle , WM_NCLBUTTONDOWN, HTCAPTION, 0);end;
end;procedure TForm1.FormCreate(Sender: TObject);
begin
top:=-17;
left:=300;
height:=30;
end;procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if top<0 then
top:=-100;
end;
主窗体拖到桌面顶部后,放开鼠标,他就会自动
缩上去,鼠标移到他身上时又会重新出现!
请问谁有研究过教我一下吧?
我写了但没有用:
procedure TForm1.CMMouseEnter(var message: TMessage);
begin
{if top=-17 then
begin//2
Height:=65 ;
SetCapture(Handle);
end;//2 // 激活窗口
}
case Message.Msg of
CM_MOUSEENTER:begin
SetCapture(Handle);
if Self.Height <= 0 then
self.Height := 30;
self.Invalidate;
end;
end;
end;procedure TForm1.CMMouseLeave(var Message: TMessage);
//var
// Pt: TPoint;
begin
{GetCursorPos(Pt);
if not PtInRect(Bounds(Left, Top, Width, Height), Pt)
then // 做此判断为过滤
begin//1
if top=-17 then
begin//2
Height:=1;
ReleaseCapture;
end;//2
end;//1
}
case Message.Msg of
CM_MOUSELEAVE: begin if self.Height > 30 then
self.Height := 0;
self.Invalidate;
ReleaseCapture;
end; end;
end;procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if Button= mbLeft then
begin
ReleaseCapture;
SendMessage(Handle , WM_NCLBUTTONDOWN, HTCAPTION, 0);end;
end;procedure TForm1.FormCreate(Sender: TObject);
begin
top:=-17;
left:=300;
height:=30;
end;procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if top<0 then
top:=-100;
end;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货