QQ 面板实现方法(delphi)(一)
2011-12-13 21:16
357 查看
实现 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;
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;
相关文章推荐
- QQ 面板实现方法(delphi)(一)
- QQ 面板实现方法(delphi)(二)
- 用DELPHI、RxRichEdit控件实现类似QQ的表情输入方法
- ie6中点击qq面板启动qq空间后session共享的解决方法
- delphi 摄像头视频图像捕捉 不用directshow来实现 还有其它什么方法吗?
- 【大话QT之八】模拟QQ系统设置面板实现功能
- asp.net类似于QQ表情弹出框功能的实现方法
- Python脚本简单实现打开默认浏览器登录人人和打开QQ的方法
- JS实现面板拖动及兼容性处理方法
- 多层数据库应用基于Delphi DataSnap方法调用的实现(一)返回数据集
- Delphi实现截屏存盘的方法
- Delphi实现窗口文字淡入淡出渐变效果的方法
- Delphi RichEdit的实现MSN / QQ 中的动画表情
- WindowLess RichEdit 实现QQ聊天窗口的气泡效果,设计思路和方法。
- 用Delphi实现文件下载的几种方法
- Delphi开发环境下利用Spcomm控件实现PC机与单片机之间串口通信的方法
- QQ伸缩面板Java实现
- asp.net类似于QQ表情弹出框功能的实现方法
- 多层数据库应用基于Delphi DataSnap方法调用的实现(四)BLOB字段的读写
- [Delphi] 实现自动化对象的一种简易方法