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

Вниз

Как создать форму, похожую на ICQ   Найти похожие ветки 

 
Mixan ©   (2002-02-02 19:43) [2]

Насчет прилипала:

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;

type
TfrMain = class(TForm)
edStickAt: TEdit;
Label1: TLabel;
chkTop: TCheckBox;
chkBottom: TCheckBox;
chkRight: TCheckBox;
chkLeft: TCheckBox;
procedure edStickAtKeyPress(Sender: TObject; var Key: Char);
private
procedure WMWINDOWPOSCHANGING (Var Msg: TWMWINDOWPOSCHANGING); message WM_WINDOWPOSCHANGING;
public
{ Public declarations }
end;

var
frMain: TfrMain;

implementation
{$R *.DFM}


procedure TfrMain.WMWINDOWPOSCHANGING (var Msg: TWMWINDOWPOSCHANGING);
const
Docked: Boolean = FALSE;
var
rWorkArea: TRect;
StickAt : Word;
begin
StickAt := StrToInt(edStickAt.Text);

SystemParametersInfo (SPI_GETWORKAREA, 0, @rWorkArea, 0);

with Msg.WindowPos^ do begin
if chkLeft.Checked then
if x <= rWorkArea.Left + StickAt then begin
x := rWorkArea.Left;
Docked := TRUE;
end;

if chkRight.Checked then
if x + cx >= rWorkArea.Right - StickAt then begin
x := rWorkArea.Right - cx;
Docked := TRUE;
end;

if chkTop.Checked then
if y <= rWorkArea.Top + StickAt then begin
y := rWorkArea.Top;
Docked := TRUE;
end;

if chkBottom.Checked then
if y + cy >= rWorkArea.Bottom - StickAt then begin
y := rWorkArea.Bottom - cy;
Docked := TRUE;
end;

if Docked then begin
with rWorkArea do begin
// no moving out of the screen
if x < Left then x := Left;
if x + cx > Right then x := Right - cx;
if y < Top then y := Top;
if y + cy > Bottom then y := Bottom - cy;
end; {with rWorkArea}
end; {if Docked}
end; {with Msg.WindowPos^}

inherited;
end;

procedure TfrMain.edStickAtKeyPress(Sender: TObject; var Key: Char);
begin
if not (key in ["0".."9"]) then Abort;
end;

end.



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

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

Наверх




Память: 0.46 MB
Время: 0.011 c
1-95
Nick_Torshin
2002-03-21 13:06
2002.04.01
Передача string из Delphi в VC++


1-83
ЛенаК
2002-03-21 07:58
2002.04.01
Как определить, на каком компоненте формы находится фокус?


3-30
Vasilii
2002-03-06 16:00
2002.04.01
Select к двум различным IB БД


14-304
Виктор55
2002-02-17 22:20
2002.04.01
Быстродействие компьютера при обычном использовании


1-168
Solod
2002-03-14 03:58
2002.04.01
Не могу разобраться ...