現在の Web フォーム プロジェクトで使用されている型に関する情報を検索できるインターフェイスを提供します。
この型のすべてのメンバの一覧については、IWebFormReferenceManager メンバ を参照してください。
Public Interface IWebFormReferenceManager
[C#]
public interface IWebFormReferenceManager
[C++]
public __gc __interface IWebFormReferenceManager
[JScript]
public interface IWebFormReferenceManager
解説
Web フォーム ドキュメント デザイナは、このインターフェイスを実装する必要があります。デザイナは、このインターフェイスを実装することにより、参照を管理し、プロジェクト内の Web フォーム コントロールに関連する情報を提供できます。
使用例
' Obtains an instance of the IWebFormReferenceManager service.
webformRefManager = _
CType(site.GetService(GetType(IWebFormReferenceManager)), _
IWebFormReferenceManager)
[C#]
// Obtains an instance of the IWebFormReferenceManager service.
webformRefManager =
(IWebFormReferenceManager)site.GetService(
typeof(IWebFormReferenceManager));
[C++]
// Obtains an instance of the IWebFormReferenceManager service.
webformRefManager =
dynamic_cast<IWebFormReferenceManager*>(site->GetService(__typeof(IWebFormReferenceManager)));
[Visual Basic]
Imports System
Imports System.ComponentModel
Imports System.ComponentModel.Design
Imports System.Drawing
Imports System.Web.UI
Imports System.Web.UI.Design
Imports System.Web.UI.WebControls
Imports System.Windows.Forms
Public Class IWebFormsReferenceManagerDesigner
Inherits System.Web.UI.Design.ControlDesigner
Public Sub New()
End Sub
Public Overrides ReadOnly Property Verbs() As System.ComponentModel.Design.DesignerVerbCollection
Get
Dim dvc As New DesignerVerbCollection()
dvc.Add(New DesignerVerb( _
"Display IWebFormsReferenceManager Interface", _
New EventHandler(AddressOf Me.showUI)))
Return dvc
End Get
End Property
Private Sub showUI(ByVal sender As Object, ByVal e As EventArgs)
Dim ui As New IWebFormsReferenceManagerUI(Me.Component.Site)
ui.ShowDialog()
End Sub
End Class
Friend Class IWebFormsReferenceManagerUI
Inherits System.Windows.Forms.Form
Private webformRefManager As IWebFormReferenceManager
Private outputBox As System.Windows.Forms.TextBox
Private typeNameEntry As System.Windows.Forms.TextBox
Public Sub New(ByVal site As System.ComponentModel.ISite)
' Obtains an instance of the IWebFormReferenceManager service.
webformRefManager = _
CType(site.GetService(GetType(IWebFormReferenceManager)), _
IWebFormReferenceManager)
' Initialize controls for form.
Me.SuspendLayout()
Me.Size = New Size(400, 400)
Me.Text = "IWebFormsReferenceManager UI"
' Create buttons
Dim b1 As New System.Windows.Forms.Button()
b1.Location = New Point(10, 10)
b1.Size = New Size(160, 20)
b1.Text = "Get Form Register Directives"
AddHandler b1.Click, AddressOf Me.GetRegisterDirectives
Me.Controls.Add(b1)
Dim b2 As New System.Windows.Forms.Button()
b2.Location = New Point(180, 10)
b2.Size = New Size(90, 20)
b2.Text = "Get Tag Prefix"
AddHandler b2.Click, AddressOf Me.GetTagPrefix
Me.Controls.Add(b2)
Dim label1 As New System.Windows.Forms.Label()
label1.Location = New Point(20, 36)
label1.Size = New Size(100, 50)
label1.Text = "Enter a type name to get the tag prefix for:"
Me.Controls.Add(label1)
typeNameEntry = New System.Windows.Forms.TextBox()
typeNameEntry.Location = New Point(126, 56)
typeNameEntry.Size = New Size(240, 20)
Me.Controls.Add(typeNameEntry)
outputBox = New System.Windows.Forms.TextBox()
outputBox.Location = New Point(10, 100)
outputBox.Size = New Size(Me.Width - 40, Me.Height - 140)
outputBox.Anchor = AnchorStyles.Left Or AnchorStyles.Right Or _
AnchorStyles.Top Or AnchorStyles.Bottom
outputBox.Multiline = True
Me.Controls.Add(outputBox)
Me.ResumeLayout()
End Sub
Private Sub GetRegisterDirectives(ByVal sender As Object, ByVal e As EventArgs)
If webformRefManager Is Nothing Then
Return
End If
outputBox.Text = "IWebFormReferenceManager.GetRegisterDirectives result:" _
+ ControlChars.Cr + ControlChars.Lf + ControlChars.Cr + ControlChars.Lf + _
webformRefManager.GetRegisterDirectives()
End Sub
Private Sub GetTagPrefix(ByVal sender As Object, ByVal e As EventArgs)
If webformRefManager Is Nothing Then
Return
End If
If typeNameEntry.Text.Length < 1 Then
outputBox.Text = "You must enter the name of a type to retrieve the tag prefix for."
Else
Dim t As Type = Type.GetType(typeNameEntry.Text)
If t Is Nothing Then
outputBox.Text = "The type for the specified type name could not be located."
Return
End If
outputBox.Text = "IWebFormReferenceManager.GetTagPrefix result for type " + _
t.Name + ":" + ControlChars.Cr + ControlChars.Lf + _
ControlChars.Cr + ControlChars.Lf + webformRefManager.GetTagPrefix(t)
End If
End Sub
End Class
<DesignerAttribute(GetType(IWebFormsReferenceManagerDesigner), GetType(IDesigner))> _
Public Class IWebFormsReferenceManagerExampleControl
Inherits System.Web.UI.WebControls.WebControl
Private [text_] As String
<Bindable(True), Category("Appearance"), DefaultValue("")> _
Public Property [Text]() As String
Get
Return [text_]
End Get
Set(ByVal Value As String)
[text_] = Value
End Set
End Property
Public Sub New()
Me.Text = "Right click to access the IWebFormsReferenceManger menu command in design mode."
End Sub
Protected Overrides Sub Render(ByVal output As HtmlTextWriter)
output.Write([Text])
End Sub
End Class
[C#]
using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Drawing;
using System.Web.UI;
using System.Web.UI.Design;
using System.Web.UI.WebControls;
using System.Windows.Forms;
namespace IWebFormsReferenceManagerExample
{
public class IWebFormsReferenceManagerDesigner : System.Web.UI.Design.ControlDesigner
{
public IWebFormsReferenceManagerDesigner() : base()
{
}
public override System.ComponentModel.Design.DesignerVerbCollection Verbs
{
get
{
DesignerVerbCollection dvc = new DesignerVerbCollection();
dvc.Add( new DesignerVerb(
"Display IWebFormsReferenceManager Interface",
new EventHandler(this.showUI)) );
return dvc;
}
}
private void showUI(object sender, EventArgs e)
{
IWebFormsReferenceManagerUI ui =
new IWebFormsReferenceManagerUI(this.Component.Site);
ui.ShowDialog();
}
}
internal class IWebFormsReferenceManagerUI : System.Windows.Forms.Form
{
private IWebFormReferenceManager webformRefManager;
private System.Windows.Forms.TextBox outputBox;
private System.Windows.Forms.TextBox typeNameEntry;
public IWebFormsReferenceManagerUI(System.ComponentModel.ISite site)
{
// Obtains an instance of the IWebFormReferenceManager service.
webformRefManager =
(IWebFormReferenceManager)site.GetService(
typeof(IWebFormReferenceManager));
// Initialize controls for form.
this.SuspendLayout();
this.Size = new Size(400, 400);
this.Text = "IWebFormsReferenceManager UI";
// Create buttons
System.Windows.Forms.Button b1 = new System.Windows.Forms.Button();
b1.Location = new Point(10,10);
b1.Size = new Size(160,20);
b1.Text = "Get Form Register Directives";
b1.Click += new EventHandler(this.GetRegisterDirectives);
this.Controls.Add( b1 );
System.Windows.Forms.Button b2 = new System.Windows.Forms.Button();
b2.Location = new Point(180,10);
b2.Size = new Size(90,20);
b2.Text = "Get Tag Prefix";
b2.Click += new EventHandler(this.GetTagPrefix);
this.Controls.Add( b2 );
System.Windows.Forms.Label label1 = new System.Windows.Forms.Label();
label1.Location = new Point(20, 36);
label1.Size = new Size(100, 50);
label1.Text = "Enter a type name to get the tag prefix for:";
this.Controls.Add(label1);
typeNameEntry = new System.Windows.Forms.TextBox();
typeNameEntry.Location = new Point(126,56);
typeNameEntry.Size = new Size(240, 20);
this.Controls.Add(typeNameEntry);
outputBox = new System.Windows.Forms.TextBox();
outputBox.Location = new Point(10, 100);
outputBox.Size = new Size(this.Width-40, this.Height-140);
outputBox.Anchor = AnchorStyles.Left | AnchorStyles.Right |
AnchorStyles.Top | AnchorStyles.Bottom;
outputBox.Multiline = true;
this.Controls.Add( outputBox );
this.ResumeLayout();
}
private void GetRegisterDirectives(object sender, EventArgs e)
{
if( webformRefManager == null )
return;
outputBox.Text = "IWebFormReferenceManager.GetRegisterDirectives result:\r\n\r\n"
+webformRefManager.GetRegisterDirectives();
}
private void GetTagPrefix(object sender, EventArgs e)
{
if( webformRefManager == null )
return;
if( typeNameEntry.Text.Length < 1 )
outputBox.Text =
"You must enter the name of a type to retrieve the tag prefix for.";
else
{
Type t = Type.GetType(typeNameEntry.Text);
if( t == null )
{
outputBox.Text = "The type for the specified type name could not be located.";
return;
}
outputBox.Text = "IWebFormReferenceManager.GetTagPrefix result for type "+t.Name+
":\r\n\r\n"+webformRefManager.GetTagPrefix(t);
}
}
}
[DesignerAttribute(typeof(IWebFormsReferenceManagerDesigner), typeof(IDesigner))]
public class IWebFormsReferenceManagerExampleControl : System.Web.UI.WebControls.WebControl
{
private string text;
[Bindable(true),
Category("Appearance"),
DefaultValue("")]
public string Text
{
get
{
return text;
}
set
{
text = value;
}
}
public IWebFormsReferenceManagerExampleControl()
{
this.text = "Right click to access the " +
"IWebFormsReferenceManger menu command in design mode.";
}
protected override void Render(HtmlTextWriter output)
{
output.Write(Text);
}
}
}
[C++]
#using <mscorlib.dll>
#using <System.dll>
#using <System.Design.dll>
#using <System.Windows.Forms.dll>
#using <System.Drawing.dll>
#using <System.Web.dll>
using namespace System;
using namespace System::ComponentModel;
using namespace System::ComponentModel::Design;
using namespace System::Drawing;
using namespace System::Web::UI;
using namespace System::Web::UI::Design;
using namespace System::Web::UI::WebControls;
using namespace System::Windows::Forms;
private __gc class IWebFormsReferenceManagerUI : public Form {
private:
IWebFormReferenceManager* webformRefManager;
System::Windows::Forms::TextBox* outputBox;
System::Windows::Forms::TextBox* typeNameEntry;
public:
IWebFormsReferenceManagerUI(ISite* site) {
// Obtains an instance of the IWebFormReferenceManager service.
webformRefManager =
dynamic_cast<IWebFormReferenceManager*>(site->GetService(__typeof(IWebFormReferenceManager)));
// Initialize controls for form.
this->SuspendLayout();
this->Size = System::Drawing::Size(400, 400);
this->Text = S"IWebFormsReferenceManager UI";
// Create buttons
System::Windows::Forms::Button* b1 =
new System::Windows::Forms::Button();
b1->Location = Point(10, 10);
b1->Size = System::Drawing::Size(160, 20);
b1->Text = S"Get Form Register Directives";
b1->Click += new EventHandler(this, &IWebFormsReferenceManagerUI::GetRegisterDirectives);
this->Controls->Add(b1);
System::Windows::Forms::Button* b2 = new System::Windows::Forms::Button();
b2->Location = Point(180, 10);
b2->Size = System::Drawing::Size(90, 20);
b2->Text = S"Get Tag Prefix";
b2->Click += new EventHandler(this, &IWebFormsReferenceManagerUI::GetTagPrefix);
this->Controls->Add(b2);
System::Windows::Forms::Label* label1 = new System::Windows::Forms::Label();
label1->Location = Point(20, 36);
label1->Size = System::Drawing::Size(100, 50);
label1->Text = S"Enter a type name to get the tag prefix for:";
this->Controls->Add(label1);
typeNameEntry = new System::Windows::Forms::TextBox();
typeNameEntry->Location = Point(126, 56);
typeNameEntry->Size = System::Drawing::Size(240, 20);
this->Controls->Add(typeNameEntry);
outputBox = new System::Windows::Forms::TextBox();
outputBox->Location = Point(10, 100);
outputBox->Size = System::Drawing::Size(this->Width-40, this->Height-140);
outputBox->Anchor = AnchorStyles(AnchorStyles::Left | AnchorStyles::Right |
AnchorStyles::Top | AnchorStyles::Bottom);
outputBox->Multiline = true;
this->Controls->Add(outputBox);
this->ResumeLayout();
}
private:
void GetRegisterDirectives(Object* /*sender*/, EventArgs* /*e*/) {
if (webformRefManager == 0)
return;
outputBox->Text =
String::Concat(S"IWebFormReferenceManager.GetRegisterDirectives result:\r\n\r\n ",
webformRefManager->GetRegisterDirectives());
}
void GetTagPrefix(Object* /*sender*/, EventArgs* /*e*/) {
if (webformRefManager == 0)
return;
if (typeNameEntry->Text->Length < 1)
outputBox->Text =
S"You must enter the name of a type to retrieve the tag prefix for.";
else {
Type* t = Type::GetType(typeNameEntry->Text);
if (t == 0) {
outputBox->Text = S"The type for the specified type name could not be located.";
return;
}
outputBox->Text =
String::Concat(S"IWebFormReferenceManager.GetTagPrefix result for type ", t->Name,
S":\r\n\r\n {0}", webformRefManager->GetTagPrefix(t));
}
}
};
public __gc class IWebFormsReferenceManagerDesigner : public ControlDesigner {
public:
IWebFormsReferenceManagerDesigner() : ControlDesigner() {
}
__property DesignerVerbCollection* get_Verbs() {
DesignerVerbCollection* dvc = new DesignerVerbCollection();
dvc->Add(new DesignerVerb(S"Display IWebFormsReferenceManager Interface",
new EventHandler(this, &IWebFormsReferenceManagerDesigner::showUI)));
return dvc;
}
private:
void showUI(Object* /*sender*/, EventArgs* /*e*/) {
IWebFormsReferenceManagerUI* ui =
new IWebFormsReferenceManagerUI(this->Component->Site);
ui->ShowDialog();
}
};
[DesignerAttribute(__typeof(IWebFormsReferenceManagerDesigner), __typeof(IDesigner))]
public __gc class IWebFormsReferenceManagerExampleControl : public WebControl {
private:
String* text;
public:
[Bindable(true),
Category(S"Appearance"),
DefaultValue(S"")]
__property String* get_Text() {
return text;
}
__property void set_Text(String* value) {
text = value;
}
IWebFormsReferenceManagerExampleControl() {
this->text =
S"Right click to access the IWebFormsReferenceManger menu command in design mode.";
}
protected:
void Render(HtmlTextWriter* output) {
output->Write(Text);
}
};
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
名前空間: System.Web.UI.Design
プラットフォーム: Windows 2000, Windows XP Professional, Windows Server 2003 ファミリ
アセンブリ: System.Design (System.Design.dll 内)