• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

QQ面板实现方法(delphi)(一)

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

实现 QQ面板的两个功能 :

 1.接近屏幕边缘时,自动隐藏。

2. 收缩式面板;

 

一。自动隐藏:

 

procedure TForm1.WMMOVING(var Msg: TMessage);
begin
  inherited;
  with PRect(Msg.LParam)^ do
  begin
    Left := Min(Max(0, Left), Screen.Width - Width);
    Top := Min(Max(0, Top), Screen.Height - Height);
    Right := Min(Max(Width, Right), Screen.Width);
    Bottom := Min(Max(Height, Bottom), Screen.Height);
    FAnchors := [];
    if Left = 0 then Include(FAnchors, akLeft);
    if Right = Screen.Width then
      Include(FAnchors, akRight);
    if Top = 0 then Include(FAnchors, akTop);
    if Bottom = Screen.Height then
      Include(FAnchors, akBottom);
      Timer1.Enabled := FAnchors <> [];
     setwindowpos(application.handle,HWND_TOPMOST,0,0,0,0,swp_hidewindow);
    end;
end;

 在from 中加一控件:TIMER。设定

procedure TForm1.Timer1Timer(Sender: TObject);
function   FindPopupControl(const   Pos:   TPoint):   TControl;
    var
        Window:   TWinControl;
    begin
        Result   :=   nil;
        Window   :=   FindVCLWindow(Pos);
        if   Window   <>   nil   then
        begin
            Result   :=   Window.ControlAtPos(Pos,   False);
            if   Result   =   nil   then   Result   :=   Window;
        end;
    end;

    const
    cOffset   =   2;
var
    vHandle:   THandle;
begin
try
begin
    vHandle   :=   WindowFromPoint(Mouse.CursorPos);
    while   (vHandle <> 0)   and   (vHandle <> Handle)   do
        vHandle   :=   GetParent(vHandle);
    if   (   vHandle   =   Handle   )     then
    begin
        if   akLeft   in   FAnchors   then   Left   :=   0;
        if   akTop   in   FAnchors   then   Top       :=   0;
        if   akRight   in   FAnchors   then   Left   :=   Screen.Width   -   Width;
        if   akBottom   in   FAnchors   then   Top   :=   Screen.Height   -   Height;
        if  BIsShow  then    //这一段是我在程序中加的。让隐藏与显示的同时刷新我的一个数据。
        begin
          BIsShow:=not BIsShow;
          btfind.Click ;

         end;
    end
    else
    begin
        if   akLeft   in   FAnchors   then   Left   :=   -Width   +   cOffset;
        if   akTop   in   FAnchors   then   Top   :=   -Height   +   cOffset;
        if   akRight   in   FAnchors   then   Left   :=   Screen.Width   -   cOffset;
        if   akBottom   in   FAnchors   then   Top   :=   Screen.Height   -   cOffset;
       BIsShow:=true;
    end;
    end;
    except
     end;
end;

 

 


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
delphi连接数据库浅谈发布时间:2022-07-18
下一篇:
delphi函数,识别字符集编码发布时间:2022-07-18
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap