Главная страница
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.012 c
1-233
Ольга
2002-03-18 16:24
2002.04.01
Outlook


1-175
AEro
2002-03-19 16:54
2002.04.01
Как передать значение из одной проги в другую?


6-277
Vlad__
2002-01-10 21:15
2002.04.01
Сокеты


3-37
Yulik
2002-03-07 11:23
2002.04.01
DbGrid


6-271
anmak
2001-11-02 16:49
2002.04.01
Socket