Difference between revisions of "TPanel/ja"
From Lazarus wiki
Jump to navigationJump to search (Created page with "{{TPanel}} {{ Japanese Menu }} '''TPanel''' image:tpanel.png is a component that creates a panel on a form. A TPanel is a descendant of TWinControl and is available...") |
|||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
{{TPanel}} | {{TPanel}} | ||
− | |||
{{ Japanese Menu }} | {{ Japanese Menu }} | ||
− | '''TPanel''' [[image:tpanel.png]] | + | '''TPanel''' [[image:tpanel.png]]は、フォーム上にパネルを作成するコンポーネントである。TPanelはTWinControlの派生であり、[[Component Palette/ja|コンポーネントパレット]]の[[Standard tab/ja|Standardタブ]]の下にある。TPanelは他のコンポーネントの可視コンテナとして機能することができる。 |
− | == | + | == 例 == |
− | + | パネルを使用する方法の1つは、コントロールグループを表示および非表示にする場合である。 | |
− | + | 個々のコントロールを表示または非表示にする代わりに、パネルとそのすべての子コントロールを1つのコマンドで非表示または表示することができる。 | |
− | + | この例では、次のコンポーネントが使用されている: [[TButton/ja]], [[TShape]] | |
=== Create code === | === Create code === | ||
− | * | + | *新しい空の[[Graphical User Interface|GUI]]アプリケーションを作成し、[[TForm|form]] Form1を作成します。 |
− | * | + | * フォームのOnCreateイベントハンドラを作成するには、フォームをクリックし、オブジェクトインスペクタを使用して、イベントタブに移動し、OnCreateイベントを選択し、[...]ボタンをクリックするか、フォーム内のボタンをダブルクリックする。 |
− | * | + | * 以下のコードを加える(足りない部分は補うこと): |
<syntaxhighlight lang="pascal"> | <syntaxhighlight lang="pascal"> | ||
Line 88: | Line 87: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | == | + | ==以下も参照のこと== |
* [[doc:lcl/extctrls/tpanel.html|TPanel doc]] | * [[doc:lcl/extctrls/tpanel.html|TPanel doc]] | ||
* [[TBevel]] | * [[TBevel]] | ||
Line 94: | Line 93: | ||
* [[TFlowPanel]] | * [[TFlowPanel]] | ||
− | {{LCL Components}} | + | {{LCL Components/ja}} |
Latest revision as of 10:26, 24 March 2024
│
Deutsch (de) │
English (en) │
suomi (fi) │
français (fr) │
日本語 (ja) │
русский (ru) │
TPanel は、フォーム上にパネルを作成するコンポーネントである。TPanelはTWinControlの派生であり、コンポーネントパレットのStandardタブの下にある。TPanelは他のコンポーネントの可視コンテナとして機能することができる。
例
パネルを使用する方法の1つは、コントロールグループを表示および非表示にする場合である。 個々のコントロールを表示または非表示にする代わりに、パネルとそのすべての子コントロールを1つのコマンドで非表示または表示することができる。 この例では、次のコンポーネントが使用されている: TButton/ja, TShape
Create code
- 新しい空のGUIアプリケーションを作成し、form Form1を作成します。
- フォームのOnCreateイベントハンドラを作成するには、フォームをクリックし、オブジェクトインスペクタを使用して、イベントタブに移動し、OnCreateイベントを選択し、[...]ボタンをクリックするか、フォーム内のボタンをダブルクリックする。
- 以下のコードを加える(足りない部分は補うこと):
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.
以下も参照のこと