Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2004.12.26;
Скачать: CL | DM;

Вниз

Как перетащить форму мышью кликая на любой её области?   Найти похожие ветки 

 
Gear   (2004-12-10 19:06) [0]

Сабж


 
Fay ©   (2004-12-10 19:20) [1]

http://rusya-hacker.narod.ru/VB_and_QB/Primeri.htm


 
grom   (2004-12-10 20:02) [2]

1.
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
ReleaseCapture;
Perform(WM_SYSCOMMAND, $F012, 0);
end;

2.
var
d: boolean;
x0,y0: integer;

procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
d := true;
x0 := x;
y0 := y;
end;

procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
d := false;
end;

procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if d then
begin
Left := Left + x - x0;
Top := Top + y - y0;
end;
end;


 
DiamondShark ©   (2004-12-10 20:10) [3]

TForm1 = class(TForm)
...
private
 procedure WMNCHitTest(var M: TWMNCHitTest); message WM_NCHITTEST;
...
end;

...

procedure TForm1.WMNCHitTest(var M: TWMNCHitTest);
begin
 inherited;
 if M.Result = HTCLIENT then M.Result := HTCAPTION;
end;


 
Fay ©   (2004-12-10 20:11) [4]

2 DiamondShark ©   (10.12.04 20:10) [3]
А нафинг inherited?


 
DiamondShark ©   (2004-12-10 20:51) [5]


> Fay ©   (10.12.04 20:11) [4]
> 2 DiamondShark ©   (10.12.04 20:10) [3]
> А нафинг inherited?

А потому что у окна кроме заголовка и клиентской части есть ещё куча эрогенных зон. Например, границы и кнопки закрытия/минимизации/сисменю.

Мы же хотим за бордюр растягивать, а "крестиком" закрывать. А таскать только за заголовок и за "серенькое".


 
Fay ©   (2004-12-10 21:10) [6]

А что, к приватным методам применим inherited?!


 
DiamondShark ©   (2004-12-10 21:14) [7]


> Fay ©   (10.12.04 21:10) [6]
> А что, к приватным методам применим inherited?!

Он не просто приватный, а обработчик сообщения.
Фактически, он dynamic.


 
Leonid Troyanovsky   (2004-12-10 21:38) [8]


> Fay ©   (10.12.04 21:10) [6]
> А что, к приватным методам применим inherited?!


Он применим даже к статическим методам
that the search for the referenced member begins with the  
immediate ancestor of the enclosing method’s class.

--
С уважением, LVT.


 
Mihey_temporary ©   (2004-12-10 23:39) [9]


> DiamondShark ©   (10.12.04 20:10) [3]


Событие OnMouseDown компонента TLabel перестаёт срабатывать.


 
Kolan ©   (2004-12-10 23:59) [10]

procedure TForm1.Image1MouseDown(Sender: TObject; Button: TMouseButton;
 Shift: TShiftState; X, Y: Integer);
begin
 If ssLeft In Shift Then
 Begin
   ReleaseCapture;
   SendMessage(Handle,WM_NCLBUTTONDOWN,HTCAPTION,0);
 End;
end;

Вот. У меня на всю форму картинка была. Переделай чуть-чуть.


 
Игорь Шевченко ©   (2004-12-11 00:11) [11]

Mihey_temporary ©   (10.12.04 23:39) [9]

Совершенно верно. Нужно еще проверять, что в ткнутом месте не расположен никакой потомок TGraphicControl.

С уважением,


 
Fay ©   (2004-12-11 17:50) [12]

2 DiamondShark ©   (10.12.04 21:14) [7][Ответить]
Проверил - работает. Я в шоке 8)

Leonid Troyanovsky   (10.12.04 21:38) [8]

> Он применим даже к статическим методам

Но не к приватным. Так ведь?


 
Leonid Troyanovsky ©   (2004-12-11 18:10) [13]


> Fay ©   (11.12.04 17:50) [12]

> > Он применим даже к статическим методам

> Но не к приватным. Так ведь?


К приватным как обычно - только в границах модуля.

--
С уважением, LVT.


 
Fay ©   (2004-12-11 18:23) [14]

2 Leonid Troyanovsky ©   (11.12.04 18:10) [13]
Ну слава ДДБ 8)


 
Leonid Troyanovsky ©   (2004-12-11 18:27) [15]


> Leonid Troyanovsky ©   (11.12.04 18:10) [13]

> > > Он применим даже к статическим методам

> > Но не к приватным. Так ведь?

> К приватным как обычно - только в границах модуля.


А.. Ты, видимо, про message handler.
Ну, там борланды, IMHO, что-то наколбасили, нужно было,
хотя бы, изображать из них protected, потому как ведут
они себя именно таким образом.

Т.е., они пишут:

To declare a message-handling method, do the following:

1 Declare the method in a protected part of the component’s class declaration.
2 Make the method a procedure.
3 Name the method after the message it handles, but without any underline characters.
4 Pass a single var parameter called Message, of the type of the message record.
5 Within the message method implementation, write code for any handling specific to the component.
6 Call the inherited message handler.

Но, в своем коде пишут их в private.
Двоечники :)

--
С уважением, LVT.



Страницы: 1 вся ветка

Текущий архив: 2004.12.26;
Скачать: CL | DM;

Наверх




Память: 0.5 MB
Время: 0.027 c
3-1101476166
Dimedrol
2004-11-26 16:36
2004.12.26
EhLib dropdown lookup list


1-1103080989
Bobby Digital
2004-12-15 06:23
2004.12.26
MouseMove


14-1102509878
}|{yk
2004-12-08 15:44
2004.12.26
UPI: Ким Чен Ир, возможно, умер


3-1101298230
keymaster
2004-11-24 15:10
2004.12.26
Client-Servet виснет


4-1100453172
dolphin
2004-11-14 20:26
2004.12.26
список имен папок и файлов