DesignerAutoFormat.Style プロパティ
アセンブリ: System.Design (system.design.dll 内)
構文DesignerAutoFormatStyle。
解説Style プロパティによって返されるオブジェクトは読み取り専用ですが、そこに含まれるそれぞれのプロパティを設定できます。たとえば、DesignerAutoFormatStyle オブジェクトの ForeColor プロパティまたは VerticalAlign プロパティを設定できます。
使用例Style プロパティを使用して Web サーバー コントロールに書式を適用する方法を次のコード例に示します。
' Applies styles based on the Name of the AutoFormat Public Overrides Sub Apply(ByVal inLabel As Control) If TypeOf inLabel Is IndentLabel Then Dim ctl As IndentLabel = CType(inLabel, IndentLabel) ' Apply formatting according to the Name If Me.Name.Equals("MyClassic") Then ' For MyClassic, apply style elements directly to the control ctl.ForeColor = Color.Gray ctl.BackColor = Color.LightGray ctl.Font.Size = FontUnit.XSmall ctl.Font.Name = "Verdana,Geneva,Sans-Serif" ElseIf Me.Name.Equals("MyBright") Then ' For MyBright, apply style elements to the Style object Me.Style.ForeColor = Color.Maroon Me.Style.BackColor = Color.Yellow Me.Style.Font.Size = FontUnit.Medium ' Merge the AutoFormat style with the control's style ctl.MergeStyle(Me.Style) Else ' For the Default format, apply style elements to the control ctl.ForeColor = Color.Black ctl.BackColor = Color.Empty ctl.Font.Size = FontUnit.XSmall End If End If End Sub
// Applies styles based on the Name of the AutoFormat public override void Apply(Control inLabel) { if (inLabel is IndentLabel) { IndentLabel ctl = (IndentLabel)inLabel; // Apply formatting according to the Name if (this.Name == "MyClassic") { // For MyClassic, apply style elements directly to the control ctl.ForeColor = Color.Gray; ctl.BackColor = Color.LightGray; ctl.Font.Size = FontUnit.XSmall; ctl.Font.Name = "Verdana,Geneva,Sans-Serif"; } else if (this.Name == "MyBright") { // For MyBright, apply style elements to the Style property this.Style.ForeColor = Color.Maroon; this.Style.BackColor = Color.Yellow; this.Style.Font.Size = FontUnit.Medium; // Merge the AutoFormat style with the control's style ctl.MergeStyle(this.Style); } else { // For the Default format, apply style elements to the control ctl.ForeColor = Color.Black; ctl.BackColor = Color.Empty; ctl.Font.Size = FontUnit.XSmall; } } }
.NET Framework のセキュリティ
プラットフォームWindows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
バージョン情報
参照DesignerAutoFormatStyle プロパティ
パブリック プロパティ| 名前 | 説明 | |
|---|---|---|
| BackColor | Web サーバー コントロールの背景色を取得または設定します。 ( Style から継承されます。) |
| BorderColor | Web サーバー コントロールの境界線の色を取得または設定します。 ( Style から継承されます。) |
| BorderStyle | Web サーバー コントロールの境界線スタイルを取得または設定します。 ( Style から継承されます。) |
| BorderWidth | Web サーバー コントロールの境界線の幅を取得または設定します。 ( Style から継承されます。) |
| Container | Component を格納している IContainer を取得します。 ( Component から継承されます。) |
| CssClass | クライアントで Web サーバー コントロールによって表示されるカスケード スタイル シート (CSS: Cascading Style Sheet) クラスを取得または設定します。 ( Style から継承されます。) |
| Font | Web サーバー コントロールに関連付けられたフォント プロパティを取得します。 ( Style から継承されます。) |
| ForeColor | Web サーバー コントロールの前景色 (通常はテキストの色) を取得または設定します。 ( Style から継承されます。) |
| Height | Web サーバー コントロールの高さを取得または設定します。 ( Style から継承されます。) |
| IsEmpty | 保護されているプロパティ。スタイル要素が状態バッグで定義されているかどうかを示す値を取得します。 ( Style から継承されます。) |
| RegisteredCssClass | コントロールに登録されているカスケード スタイル シート (CSS) を取得します。 ( Style から継承されます。) |
| Site | Component の ISite を取得または設定します。 ( Component から継承されます。) |
| VerticalAlign | 関連付けられているコントロールの内容の垂直方向の配置を取得または設定します。 |
| Width | Web サーバー コントロールの幅を取得または設定します。 ( Style から継承されます。) |
プロテクト プロパティ| 名前 | 説明 | |
|---|---|---|
| CanRaiseEvents | コンポーネントがイベントを発生させることがきるかどうかを示す値を取得します。 ( Component から継承されます。) |
| DesignMode | Component が現在デザイン モードかどうかを示す値を取得します。 ( Component から継承されます。) |
| Events | Component に結び付けられているイベント ハンドラのリストを取得します。 ( Component から継承されます。) |
| IsTrackingViewState | スタイル要素が状態バッグで定義されているかどうかを示す値を返します。 ( Style から継承されます。) |
| ViewState | スタイル要素を保持している状態バックを取得します。 ( Style から継承されます。) |
参照- DesignerAutoFormat.Style プロパティのページへのリンク