ControlDesigner.GetEditableDesignerRegionContent メソッド
アセンブリ: System.Design (system.design.dll 内)
構文Public Overridable Function GetEditableDesignerRegionContent ( _ region As EditableDesignerRegion _ ) As String
Dim instance As ControlDesigner Dim region As EditableDesignerRegion Dim returnValue As String returnValue = instance.GetEditableDesignerRegionContent(region)
戻り値
編集可能な領域をコントロール デザイナがサポートする場合は領域の永続化された内容。それ以外の場合は空の文字列 ("")。
解説GetEditableDesignerRegionContent メソッドの既定の実装では、空の文字列 ("") が返されます。
ControlDesigner クラスから派生したクラスでは、デザイン サーフェイスでの領域ベースの編集をサポートでき、GetEditableDesignerRegionContent メソッドをオーバーライドして指定した領域の内容を返すことができます。
使用例デザイン ホストへの参照を取得し、その参照を使用して、region およびその内容の HTML マークアップを作成する ControlParser オブジェクトを作成する方法のコード例を次に示します。
' Get the content string for the selected region. Called by the designer host? Public Overrides Function GetEditableDesignerRegionContent(ByVal region As EditableDesignerRegion) As String ' Get a reference to the designer host Dim host As IDesignerHost = CType(Component.Site.GetService(GetType(IDesignerHost)), IDesignerHost) If Not IsNothing(host) Then Dim template As ITemplate = myControl.View1 If region.Name = "Content1" Then template = myControl.View2 End If ' Persist the template in the design host If Not IsNothing(template) Then Return ControlPersister.PersistTemplate(template, host) End If End If Return String.Empty End Function
// Get the content string for the selected region. Called by the designer host? public override string GetEditableDesignerRegionContent(EditableDesignerRegion region) { // Get a reference to the designer host IDesignerHost host = (IDesignerHost)Component.Site.GetService(typeof(IDesignerHost)); if (host != null) { ITemplate template = myControl.View1; if (region.Name == "Content1") template = myControl.View2; // Persist the template in the design host if (template != null) return ControlPersister.PersistTemplate(template, host); } return String.Empty; }
.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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
バージョン情報
参照- ControlDesigner.GetEditableDesignerRegionContent メソッドのページへのリンク