做一个侧边栏,鼠标移到上面的时候显示,该怎么写啊?abf组件里面有吗?
解决方案 »
- Service与SQL2000数据库使用,内存泄露
- html页面中如何调DELPHI的窗口
- (来者有分)头儿分配的项目,目前一点头绪都没有,请各位DX指个方向
- 如何截获控件的按键事件? 进来看详情
- DBchart 动态板定 怎么操作啊
- 请问我想在工程里做几个公用函数,不需要界面的,就新建了一个UNIT,里面写了函数,可说申明出错
- 弄不明白的数据库更新问题?
- 用鼠标拖动一Label进Memo,如何动态改变Memo当前光标位置跟随鼠标移动
- 怎样在程序中控制输入法?
- 我用f1book作报表,请问在程序中能否给f1book中的cell加上框线?
- 继承并改良TButton
- 下了一个delphi做的系统,却总是不能正确的运行出来,想知道为什么
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, ExtCtrls,Math, StdCtrls;type
TForm1 = class(TForm)
Timer1: TTimer;
Label1: TLabel;
procedure Timer1Timer(Sender: TObject);
private
FAnchors: TAnchors;
procedure WMMOVING(var Msg: TMessage);message WM_MOVING;
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}
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 <> [];
end;
end;procedure TForm1.Timer1Timer(Sender: TObject);
const
cOffset = 2;
begin
if WindowFromPoint(Mouse.CursorPos) = 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;
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;
end;
end;end.
这个DelphiDemos.zip中就是这个改良后的新按钮:TJHLButton
完全源代码,欢迎下载。作者:金海龙(软件工程师)
要想了解作者的权威程度,就用Google搜索‘金海龙’三个字。
这篇文章节选自:Delphi高级组件开发指南 第一篇
URL:http://www.docin.com/p-116784103.html按钮TJHLButton组件下载:DelphiDemos.zip
http://www.filefactory.com/file/b4he896/n/DelphiDemos.zip