PrintDocument for WinForms
AmbientParent プロパティ (Style)
使用例 


C1.PrintDocument.6 アセンブリ > C1.C1Preview 名前空間 > Style クラス : AmbientParent プロパティ
Gets or sets the Style that is the ambient parent of the current style.

If non-null, that style provides the values for ambient properties of the current style that have not been explicitly set.

If null, such properties are inherited from the style of the containing object.

This property is null by default.

シンタックス
'宣言
 
Public Property AmbientParent As Style
'使用法
 
Dim instance As Style
Dim value As Style
 
instance.AmbientParent = value
 
value = instance.AmbientParent
public Style AmbientParent {get; set;}
解説
Initially a Style object does not have any explicitly set properties. This means that the effective values of all ambient properties (such as font) are inherited from the style of the containing object, unless this property has been set to a non-null value, in which case they are inherited from that style.

Note that even if an AmbientParent has been specified, only ambient properties that have been explicitly set on that style or any of its own ambient parents (styles or containing objects) propagate to the current style. See example below for details.

使用例
For instance, the following code: still prints "my text" in bold, while this code: prints "my text" using regular (non-bold) font. This is because Style.FontBold has been explicitly set to false on the style assigned to the AmbientParent on the text object.
C1PrintDocument doc = new C1PrintDocument();
RenderArea ra = new RenderArea();
ra.Style.FontBold = true;
RenderText rt = new RenderText("my text");
ra.Style.AmbientParent = doc.Style;
ra.Children.Add(rt);
doc.Body.Children.Add(ra);
C1PrintDocument doc = new C1PrintDocument();
doc.Style.FontBold = false; // this line makes the difference!
RenderArea ra = new RenderArea();
ra.Style.FontBold = true;
RenderText rt = new RenderText("my text");
ra.Style.AmbientParent = doc.Style;
ra.Children.Add(rt);
doc.Body.Children.Add(ra);
参照

Style クラス
Style メンバ