V
visual_cjiajia
Unregistered / Unconfirmed
GUEST, unregistred user!
1)"OICQ“不用我多说了吧,然而,当我们把QQ<br> 主窗体拖到桌面顶部后,放开鼠标,他就会自动<br> 缩上去,鼠标移到他身上时又会重新出现!<br> 大富翁上的高手说在<br> procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER;<br> procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE;<br> 在这两个消息映射中实现,然而不管我怎么写<br> 我的窗体都没反应(不会动),请问谁有研究过<br> 教我一下吧?<br><br>我写了但没用:<br>procedure TForm1.CMMouseEnter(var message: TMessage);<br>begin<br>{if top=-17 then<br>begin//2<br>Height:=65 ;<br>SetCapture(Handle);<br>end;//2 // 激活窗口<br>}<br> case Message.Msg of<br> CM_MOUSEENTER:begin<br> SetCapture(Handle);<br> if Self.Height <= 0 then<br> self.Height := 30;<br> self.Invalidate;<br> end;<br> end;<br><br><br>end;<br><br>procedure TForm1.CMMouseLeave(var Message: TMessage);<br>//var<br>// Pt: TPoint;<br>begin<br> {GetCursorPos(Pt);<br> if not PtInRect(Bounds(Left, Top, Width, Height), Pt)<br> then // 做此判断为过滤<br> begin//1<br> if top=-17 then<br> begin//2<br> Height:=1;<br> ReleaseCapture;<br> end;//2<br> end;//1<br> }<br> case Message.Msg of<br> CM_MOUSELEAVE: begin<br><br> if self.Height > 30 then<br> self.Height := 0;<br> self.Invalidate;<br> ReleaseCapture;<br> end;<br><br> end;<br><br><br>end;<br><br>procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;<br> Shift: TShiftState; X, Y: Integer);<br>begin<br>if Button= mbLeft then<br>begin<br>ReleaseCapture;<br>SendMessage(Handle , WM_NCLBUTTONDOWN, HTCAPTION, 0);<br><br>end;<br>end;<br><br>procedure TForm1.FormCreate(Sender: TObject);<br>begin<br>top:=-17;<br>left:=300;<br>height:=30;<br>end;<br><br>procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;<br> Shift: TShiftState; X, Y: Integer);<br>begin<br>if top<0 then<br> top:=-100;<br>end;