Текущий архив: 2004.10.10;
Скачать: CL | DM;
Вниз
Перетаскивать форму в клиентской части Найти похожие ветки
← →
DelphiLexx (2004-09-27 13:20) [0]Для того, чтобы перетащить форму в клиентской части, необходимо
написать:
...
private
procedure MoveForm(var Msg:TWMNCHitTest);message WM_NCHitTest;
...
procedure TForm1.MoveForm(var Msg:TWMNCHitTest);
begin
inherited;
if Msg.Result = htClient then Msg.Result:=htCaption;
end;
...
Но после этого контекстное меню на работает. Вопрос: Как заставить
контекстное меню работать, при этом можно было бы перетаскивать форму
в клиентской части.
← →
Mim1 © (2004-09-27 18:52) [1]Перетаскивайте ее не средствами windows. Например так.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure Button1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
xpos,ypos : integer;
implementation
{$R *.DFM}
procedure TForm1.Button1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
var rt : trect;
begin
if ssRight in Shift then
begin
GetWindowRect(button1.handle,rt);
MapWindowPoints(0,GetParent(button1.handle),rt,2);
MoveWindow(button1.handle,rt.left+(x-xpos),rt.top+(y-ypos),rt.Right - rt.Left,
rt.Bottom - rt.top,true);
end;
end;
procedure TForm1.Button1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
xpos := x;
ypos := y;
end;
end.
← →
grom (2004-09-27 19:21) [2]procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
ReleaseCapture;
Perform(WM_SYSCOMMAND, $F012, 0);
end;
может так подойдёт.
Страницы: 1 вся ветка
Текущий архив: 2004.10.10;
Скачать: CL | DM;
Память: 0.47 MB
Время: 0.028 c