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

Вниз

Непрямоугольная панель   Найти похожие ветки 

 
android ©   (2002-05-25 13:28) [0]

Как можно создать панель любой формы и потом двигать её по форме мышкой(в RunTime), отслеживая координаты из программы?


 
cypher ©   (2002-05-25 13:32) [1]

Самый простой вариант... найди компонент круглой кнопки с исходниками и добавь туда движения мышкой (сообщения MouseDown, UP, Move)... Разумеется от кнопки требуется тока понять как ее сделать круглой.. =)


 
Proton   (2002-05-25 14:40) [2]

Пример тебя устроит ?
Заметь регионы бывают любой формы.


**** PAS

unit Unit1;

interface

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

type
TForm1 = class(TForm)
Panel1: TPanel;
procedure Panel1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure Panel1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;
xpos,ypos : integer;

implementation

{$R *.DFM}

procedure TForm1.Panel1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
var rt : trect;
begin
if ssLeft in Shift then
begin
GetWindowRect(Panel1.handle,rt);
MapWindowPoints(0,GetParent(Panel1.handle),rt,2);
MoveWindow(Panel1.handle,rt.left+(x-xpos),rt.top+(y-ypos),rt.Right - rt.Left,
rt.Bottom - rt.top,true);
end;
end;

procedure TForm1.Panel1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
xpos := x;
ypos := y;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
SetWindowRgn(Panel1.Handle,CreateEllipticRgn(1,1,Panel1.Width,Panel1.Height),true);
end;

end.

****** DFM

object Form1: TForm1
Left = 192
Top = 106
Width = 544
Height = 375
Caption = "Form1"
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = "MS Sans Serif"
Font.Style = []
OldCreateOrder = False
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
object Panel1: TPanel
Left = 152
Top = 176
Width = 185
Height = 41
Caption = "Panel1"
Color = 10930928
TabOrder = 0
OnMouseDown = Panel1MouseDown
OnMouseMove = Panel1MouseMove
end
end



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

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

Наверх




Память: 0.47 MB
Время: 0.01 c
1-17984
neodiX
2002-05-23 18:15
2002.06.06
Воспроизведение картинки из TMemoryStream a


1-17976
ION T
2002-05-28 14:54
2002.06.06
Параметры register


4-18195
Biorobot
2002-04-04 15:16
2002.06.06
Как в Win2k скрыть из списка прорцессов программу


1-17963
mixen
2002-05-27 18:06
2002.06.06
просмотр текстового файла


4-18200
cad
2002-04-02 16:08
2002.06.06
Как выделить строку ListView чужого окна?7