问题是这样的:
_______________________
| |
| A B |
| |
| S |
| V |
| |
| C H |
| |
-------------------------
框代表图片(image),字母代表注释(label)
程序运行时,动态创建多个Timage,和多个Tlabel,每个image对应多个label,
Tabel 是用来解释Image某个点的说明文字。Tlabel和Timage都的mousedown, mouseMove,mouseup事件。
它们都可以移动(单个)。现在我想同时多个,其实就是,移动image时,和它对应的label也跟着移动。
请问:如何实现,给点思路,有源码最好。。谢谢!!
_______________________
| |
| A B |
| |
| S |
| V |
| |
| C H |
| |
-------------------------
框代表图片(image),字母代表注释(label)
程序运行时,动态创建多个Timage,和多个Tlabel,每个image对应多个label,
Tabel 是用来解释Image某个点的说明文字。Tlabel和Timage都的mousedown, mouseMove,mouseup事件。
它们都可以移动(单个)。现在我想同时多个,其实就是,移动image时,和它对应的label也跟着移动。
请问:如何实现,给点思路,有源码最好。。谢谢!!
解决方案 »
- delphi webbrowser网页复选框填表的问题
- Delphi擂台赛第一期结果揭晓
- 是高手的,进来!查询最近两条记录,感觉很难,各位高手,有什么方法最快?
- 怎样用FASTREPORT实现如下打印格式??
- delphi6.0+Interbase6.5(dielect 1->dialect 3)
- 请教一条SQL语句,关于日期查询方面。
- 怎样实现这种功能?
- 如何比较字符的 ASCII 的大小???
- 动态绑定tquery与dbgrid控件使用---新手
- 那位仁兄有 关于从.INI 文件中读取值设置DEGRID的TITLE CAPTION 的资料,请不啬赐教.
- delphi 的报表--饼图
- 午夜求助(关于Dll中放置ADOQuery控件导致程序崩溃的问题)
MSStickyLabel v1.1 July/5/97 by Glenn Shukster & Jacques Scoatarin
- Released on public.
V 1.2 Aug/14/97
- Thanks to Erik B. Berry <[email protected]> &
Jean-Christophe Boggio <[email protected]> who reported the
behavior below
- Corrected weird behavior that occured when the panel was aligned
bottom and then you assign the TGMSStickylabel
- Corrected if TGMSStickyLabel is moved from _AttachedTo component
back to the same _AttachedTo component it would not realign itself.
Now it does.
- Corrected when selecting _AttachedTo you could select a component
who did not have the same parent with poor results: Added a
property editor that only displays TWinControls that have the same parent.
V 1.3 Sep/22/97
- Thanks to Gerald [email protected] for reporting the following bug
- Bug in only Delphi3 version. When there is something aligned to top and
a new TGMSStickyLabel is dropped on a component it will loop through all the
components 3 times with the RectBounds of the TGMSStickyLabel being incorrect
until the last loop. In Delphi2 & 1 it only goes thought the loop once with
the correct co-ordinates.
Solution was that only attach if (Self.BoundsRect.Top > 0)
This is a trade off for if you ever try to drop a component at position 0 it will
not attach. Drop it just a bit below 0 and it will align no problem.
- Thanks to Erik B. Berry <[email protected]> for the below improvement
Eric suggested to have the component alignment be laRightJustify if the _AlignTo
is alLeft. This way when editing the caption it will grow away from the control
its attached to, thus not asking to attach to it again.
V 1.4 Nov/12/97
- Added options the following options to the property editor
alignment (right, left, top, bottom), Set gap, Edit Caption
V 1.5 Jan/10/98
- Changed all Assigned(FAttachTo) to the Nil syntax eg. (FAttachTo<>Nil)
for Delphi 3 in some cases this caused problems
- Fixed _AttachTo so it could be blanked if needed. Before once a TWinControl
was assigned this property could not be empty
- Added _Offset
- Thanks to Mike King from London UK at <[email protected]> for suggesting
this option
V 2 Jan/27/98
- Removed the annoying repeated question to attach to another TWinControl when
you are moving the TWinControl with a TGMSStickylabel attached and it overlaps
with another TWinControl.
- Changed name from _Offset to _AlignPosGap, 1.5 was only distributed to a small few,
thus, now was the time to change it, if you had TGMSStickylabels using _Offset it
will blank them all to 0.
- Changed the name of the Component Editor to GMSLabCE.pas (kept it to 8 char for
Delphi1 compatibility) Delete the old one called LblEdit.pas
- Added _AlignPos thanks to Erik B. Berry <[email protected]> DesignIntf,DesignEditors,
}
unit XXX;{$D-} { Turns debugger off comment this line out if you want to step through it}interfaceuses
Classes,
StdCtrls,
Controls,
Messages,
Forms,
Dialogs,
//DsgnIntf,
DesignEditors,
designintf,
{$IFDEF WIN32}
SysUtils, { for writing to file for debugging purposes}
Windows
{$ELSE}
WinProcs, WinTypes
{$ENDIF}
;type
TAlignTo = (alLeft, alTop, alBottom, alRight);
TAlignPos = (alTopLeft, alCenter, alBottomRight);
TGMSStickyLabel = class(TLabel)
private
FAttachTo: TWinControl;
FAlignTo: TAlignTo;
FAlignPos: TAlignPos;
FGap : Integer;
FAlignPosGap:integer;
FDefAttachedProc: Pointer;
FAttachedInstance: Pointer;
FRealigning: Boolean;
Procedure SetGap(Value: Integer);
procedure SetAttachTo(Value: TWinControl);
Procedure SetAlignTo(Value: TAlignTo);
Procedure SetAlignPosGap(Value: Integer);
procedure SetAlignPos(Value: TAlignPos);
{ New Attached controls WndProc }
procedure AttachedWndProc(var Message: TMessage);
{ Procedure ErrFile(sString: String);}
protected
procedure CheckForControl;
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
procedure SetParent(AParent: TWinControl); override;
{ Override WndProc }
procedure WndProc(var Message: TMessage); override;
public
Procedure _ReAlign;
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
property _AlignTo: TAlignTo read FAlignTo write SetAlignTo default alLeft;
property _AttachTo: TWinControl read FAttachTo write SetAttachTo;
Property _Gap : Integer Read FGap write SetGap Default 5;
property _AlignPos : TAlignPos Read FAlignPos write SetAlignPos Default alCenter;
Property _AlignPosGap: integer read FAlignPosGap write SetAlignPosGap default 4;
end;procedure Register;implementationconstructor TGMSStickyLabel.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FGap := 5;
FAlignPosGap := 0;
FRealigning := False;
FAlignPos := alCenter;
{ Make Instance out of method }
FAttachedInstance := MakeObjectInstance(AttachedWndProc);
end;destructor TGMSStickyLabel.Destroy;
begin
{ Restore original Attach Control WndProc }
{ IsWindow check may be uneccessary but doesn't hurt ti be 100% sure }
if (FAttachTo<>Nil) and IsWindow(FAttachTo.Handle) then
SetWindowLong(FAttachTo.Handle, GWL_WNDPROC, Longint(FDefAttachedProc));
{ Make method Instance }
FreeObjectInstance(FAttachedInstance);
inherited Destroy;
end;procedure TGMSStickyLabel.AttachedWndProc(var Message: TMessage);
begin
with Message do
begin
case Msg of
{ On Move/Size message call _ReAlign to keep us aligned! }
WM_MOVE, WM_SIZE : _ReAlign;
end;
Result := CallWindowProc(FDefAttachedProc, FAttachTo.Handle, Msg, WParam, LParam);
end;
end;http://members.tor.shaw.wave.ca/~gms/ //具体下载 地址 太长写不下
2、在窗口的MouseDown事件里加入代码:
ReleaseCapture;
Windows.SendMessage(窗口名.Handle, WM_SYSCOMMAND, $F012, 0);
2、在窗口的MouseDown事件里加入代码: ReleaseCapture;
Windows.SendMessage(窗口名.Handle, WM_SYSCOMMAND, $F012, 0);