


 
 
 
 
 
 
 |
DelphiXE4 [FMX]パスラベル(PathLabel) 2015/04/10 |
前回は[Standard]内の「イメージコントロール(ImageControl)」について記述しましたので、今回は、同じく[Standard]内の「パスラベル(PathLabel)」について記述します。これはDelphi2010、XE3のVCLアプリケーションにはありません。パス図形を表示するコンポーネントです。
【DelphiXE3[FMXアプリケーション]の記事はこちら】
XE4(FMX)
FMX.StdCtrls.TPathLabel |
XE3(FMX)
FMX.Controls.TPathLabel |
 |  |
 |  |
ユニットが変わっていますが、オブジェクトインスペクタでは、プロパティ・イベント共に変わっていない様子です。
(ヘルプより)
Data
バインディングのために、子の 1 つに関連付けられているデータを示します。 |
FMX.Types.TPathData
TPathDataは、一連の接続された曲線や直線を表します。
TPathDataを使用すると、一連の曲線や直線を連結することでグラフィック図形を作成できます。TPathDataは、TCanvasをコンポーネントとして持つオブジェクト上で、描画したり塗りつぶすことができます。
TPathDataを使用すると、TPathAnimationの適用時にたどるパスを作成することができます。
TPathDataは、ワールド座標空間における幾何学的図形の座標を、TPathPointの配列内に保持します。定義している基本図形を識別するため、保存された各点には特定の型があります。TPathDataの複合図形は、直線や曲線などの一連の基本図形で構成されます。TPathPointの配列にアクセスするには、CountおよびPointsを使用します。
TPathDataを初期化するには、Dataプロパティを設定するか、新しい図形をそれぞれ明示的に追加します。TPathDataは、図形を明示的に追加する方法が定義されています。「TPathDatafunctions」を参照してください。
TPathDataが生成されると、デフォルトでは、追加する新しい図形はそれぞれ、TPathDataの末尾に追加されます。前の図形の終了点が新しい図形の開始点になります。追加する新しい要素の開始点をカスタマイズするには、MoveToメソッドまたはMoveToRelメソッドを使用します。 |
WrapMode
このパスラベルのコンテンツを描画される際の方法を示します。
WrapModeは、次の値のいずれかを取ります。
pwFit
グラフィカルパスコンテンツは、このパスラベルの領域全体に合わせて表示されます。
pwOriginal
グラフィカルパスコンテンツは、このパスラベル内に、元のサイズで表示されます。
pwStretch(デフォルト)
グラフィカルパスコンテンツは、このパスラベルの領域全体に合わせて、引き伸ばされます。
pwTile
グラフィカルパスコンテンツは、このパスラベルの領域全体を埋めるように、1回または複数回、タイル状に敷き詰められます。 |
TPathDataに格納されている情報を FireMonkey フォーム内に表示するためのグラフィカル コントロールを表します。
FireMonkey フォームで TPathLabel コンポーネントを使用すると、TPathData の表示機能を追加できます。たとえば、以下の画像では、TPathData オブジェクトを使って 3 つの四角形を表示しています。
var
PathData: TPathData;
begin
PathData:= TPathData.Create;
PathData.AddRectangle(RectF(20, 20, 80, 80), 0, 0, AllCorners);
PathData.AddRectangle(RectF(10, 10, 90, 90), 0, 0, AllCorners);
PathData.AddRectangle(RectF(0, 0, 100, 100), 0, 0, AllCorners);
PathLabel1.Data := PathData;
{ ... other instructions ... } |
|
|
Dataプロパティの右端にある[…]をクリックすると

のような画面が表示されますが、これの使い方がさっぱり分かりません。「SVG」とあるので、SVGファイルをテキスト状態で貼り付けたらプレビューにその絵が出るのかと思いましたが、全く反応せず、何をどうしたら良いのかよく分かりません。
ヘルプにあるプログラムコードをボタンを押したら実行するようにしてみます。

procedure TForm1.Button1Click(Sender: TObject);
var
PathData: TPathData;
begin
PathData:= TPathData.Create;
PathData.AddRectangle(RectF(20, 20, 80, 80), 0, 0, AllCorners);
PathData.AddRectangle(RectF(10, 10, 90, 90), 0, 0, AllCorners);
PathData.AddRectangle(RectF(0, 0, 100, 100), 0, 0, AllCorners);
PathLabel1.Data := PathData;
end; |
保存・コンパイル・実行を行います。

↓

WrapModeプロパティの指定によって表示方法は変わってきます。
例えば、
procedure TForm1.Button2Click(Sender: TObject);
begin
PathLabel1.WrapMode := TPathWrapMode.pwFit;
Disp;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
PathLabel1.WrapMode := TPathWrapMode.pwOriginal;
Disp;
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
PathLabel1.WrapMode := TPathWrapMode.pwStretch;
Disp;
end;
procedure TForm1.Button5Click(Sender: TObject);
begin
PathLabel1.WrapMode := TPathWrapMode.pwTile;
Disp;
end;
procedure TForm1.Disp;
var
PathData: TPathData;
begin
PathData:= TPathData.Create;
PathData.AddEllipse(RectF(0,0,10,10));
PathLabel1.Data := PathData;
end; |
のようにした場合、
WrapModeプロパティ値によって下図のようになります。
pwFit
 |
pwOriginal
 |
pwStretch(デフォルト)
 |
pwTile
 |
指定無し |
Air.Style |

Amakrits.Style |

AquaGraphite.style |

Blend.Style |

Dark.style |

GoldenGraphite.Style |

Light.Style |

RubyGraphite.style |

Transparent.Style |
MacOSX でも動作することが確認出来ます。
|
|
バッチファイル
BASIC
C言語のお勉強
拡張子な話
DOSプログラム
Delphi
>Delphi入門編
>Delphi2010
>DelphiXE3
>DelphiXE4
△TOP
▲2015/04/09
2015/04/10
▼2015/04/11
シェアウェア
Script!World
データベース
|