Показать сообщение отдельно
  #4  
Старый 23.03.2014, 12:52
Gudzik11 Gudzik11 вне форума
Начинающий
 
Регистрация: 27.09.2011
Сообщения: 158
Репутация: 10
По умолчанию

конкретней можно

Вот сам код кому неохота качать
Код:
unit Unit1;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, Vcl.StdCtrls, Vcl.Buttons;

type
  TForm1 = class(TForm)
    Panel3: TPanel;
    ListBox1: TListBox;
    Panel4: TPanel;
    Panel1: TPanel;
    Panel2: TPanel;
    SpeedButton1: TSpeedButton;
    SpeedButton2: TSpeedButton;
    SpeedButton3: TSpeedButton;
    procedure FormCreate(Sender: TObject);
    procedure SpeedButton3Click(Sender: TObject);
    procedure PClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  i,j,l: Byte ;
  w,h: Integer;
implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
 Form1.Left:=10;
 Form1.Width:= Screen.WorkAreaWidth - 20 ;
 Form1.top:= Screen.WorkAreaHeight - Form1.Height;
 end;

procedure TForm1.PClick(Sender: TObject);
begin
 //ShowMessage('Нажата'+ (sender as TPanel).Caption);
 for i:=0 to Panel1.ControlCount-1 do
  if (Panel1.Controls[i] is TPanel) then  // and (Panel4.Controls[i] <> Sender) and (Pos('Pages',TPanel(Panel4.Controls[i]).Caption) = 1)
  begin
   TPanel(Panel1.Controls[i]).Color:=clSilver;
  (sender as TPanel).Color:= clLime;
  end;
end;

procedure TForm1.SpeedButton3Click(Sender: TObject);
var
 Pages: array [0..20] of TPanel;
begin
 Pages[i]:= TPanel.Create(Self);
    with Pages[i] do
     begin
      Parent:=Panel1;
      Align:=alLeft;
      AlignWithMargins:=True;
      //Left:=3;
     // top:=3;
     // Width:= Panel1.Width - 6;
     // Height:= Panel1.Height - 6;
      Color:=clSilver; // цвет панели
      Name:='Pages'+inttostr(i); //
      Caption:='Pages'+inttostr(i);
      Font.Size:=9;  // размер шрифта
      Font.Style:=[fsbold];  // жирный шрифт
      OnClick:=PClick;    // клик для панели
      ParentBackground:=False; // для окраски панели
      ListBox1.Items.Add(Pages[i].Name);

     end;

 For j := 0 to ListBox1.Items.Count-1 do
  begin
   //TPanel(ListBox1.Items[j].s      ListBox1[j]).SetBounds(l, 0, w, h);
   Inc(l, w);
  end;

 Inc(i);
end;

end.
Ответить с цитированием