
26.05.2008, 13:19
|
Модератор
|
|
Регистрация: 17.04.2008
Сообщения: 8,097
Версия Delphi: 7, XE3, 10.2
Репутация: 49089
|
|
А в чем проблема то?
Форма:
Код:
object Form1: TForm1
Left = 192
Top = 114
Width = 870
Height = 640
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 Shape1: TShape
Left = 88
Top = 72
Width = 65
Height = 65
end
object ScrollBar1: TScrollBar
Left = 88
Top = 40
Width = 305
Height = 17
Max = 300
Min = 10
PageSize = 0
Position = 10
TabOrder = 0
OnChange = ScrollBar1Change
end
object ScrollBar2: TScrollBar
Left = 56
Top = 72
Width = 17
Height = 305
Kind = sbVertical
Max = 300
Min = 10
PageSize = 0
Position = 10
TabOrder = 1
OnChange = ScrollBar2Change
end
end
Код:
Код:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
Shape1: TShape;
ScrollBar1: TScrollBar;
ScrollBar2: TScrollBar;
procedure FormCreate(Sender: TObject);
procedure ScrollBar1Change(Sender: TObject);
procedure ScrollBar2Change(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
// Инициализация скроллбаров
ScrollBar1.Position := Shape1.Width;
ScrollBar2.Position := Shape1.Height;
end;
procedure TForm1.ScrollBar1Change(Sender: TObject);
begin
Shape1.Width := ScrollBar1.Position;
end;
procedure TForm1.ScrollBar2Change(Sender: TObject);
begin
Shape1.Height := ScrollBar2.Position;
end;
end.
|