Sign in Join
Wiki copytemporary

TPanel/ja

Deutsch · English · Français · Suomi · Русский · 日本語

TPanel は、フォーム上にパネルを作成するコンポーネントである。TPanelはTWinControlの派生であり、コンポーネントパレットのStandardタブの下にある。TPanelは他のコンポーネントの可視コンテナとして機能することができる。

例

パネルを使用する方法の1つは、コントロールグループを表示および非表示にする場合である。 個々のコントロールを表示または非表示にする代わりに、パネルとそのすべての子コントロールを1つのコマンドで非表示または表示することができる。 この例では、次のコンポーネントが使用されている: TButton/ja, TShape

Create code

pascal

unit Unit1;

{$mode objfpc}{$H+}

interface

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

type

  { TForm1 }

  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  private
    aPanel:TPanel;
    procedure aButtonClick(Sender: TObject);
  public

  end;

var
  Form1: TForm1;

implementation

{$R *.lfm}

{ TForm1 }

procedure TForm1.FormCreate(Sender: TObject);
var
  aButton:TButton;

  aShape1,aShape2:TShape;
begin
  Caption :='Panel demo';
  aButton:=TButton.Create(Self);
  aButton.Parent:=Self;
  aButton.Caption:= 'Show/Hide';
  aPanel:=TPanel.Create(Self);
  aPanel.Parent:=Self;
  aPanel.Caption:='';
  aShape1:=TShape.Create(aPanel);
  aShape1.Parent:=aPanel;
  aShape1.Shape:=stStar;
  aShape1.Top := 5;
  aShape2:=TShape.Create(aPanel);
  aShape2.Parent:=aPanel;
  aShape2.Shape:=stStar;
  aShape2.Top := 5;
  aShape2.Left:=aShape1.Width+10;
  aPanel.Height:=aShape1.Height+10;
  aButton.Top:=aPanel.Height+10;
  aButton.OnClick:=@aButtonClick;
  Height := aButton.Top+aButton.Height+10;
end;

procedure TForm1.aButtonClick(Sender: TObject);  //the event handler for the button
begin
  if (Sender is TButton)
    then begin
      if aPanel.Visible then aPanel.Visible := false else aPanel.Visible := true;
    end;
end;
end.

以下も参照のこと


From the Free Pascal wiki, page "TPanel/ja", as it stood on 2024-03-24 after a change by Ariben, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 1, last changed by WikiArchive .

Edited on wiki.freepascal.org by 1 person, 2024

From the official wiki's backup of 26 May 2024: who edited this page there, and when. Edits made there after that date were not recorded, and the earlier versions are not shown here; the main page says why.

WhenWhoWhat changed
AribenCreated page
AribenSee also
Ariben

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.