Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 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
14-1094669161
olookin
2004-09-08 22:46
2004.10.10
We are living in Amerika - Rammstein


1-1095923924
Arnold
2004-09-23 11:18
2004.10.10
Вопрос по свойствам!!!


3-1094737576
ZedeS
2004-09-09 17:46
2004.10.10
Отображение в Gridе


1-1096117057
Nils
2004-09-25 16:57
2004.10.10
Нужен пример работы с TMemIni?


4-1094636556
HeKTO
2004-09-08 13:42
2004.10.10
Подскажите функцию определения координат чужого окна..забыл...