Главная страница
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.031 c
14-1095927192
REP
2004-09-23 12:13
2004.10.10
Что такое поддержка MPEG4 в TV тюнерах?


14-1095773192
Uncle Archi
2004-09-21 17:26
2004.10.10
GLScene


6-1091362783
maguk
2004-08-01 16:19
2004.10.10
Вопрос по SOCK_RAW


14-1095925098
begin...end
2004-09-23 11:38
2004.10.10
NTFS


14-1095948726
Zombie
2004-09-23 18:12
2004.10.10
Хочу FM-тюнер!!!