About the Implementing a property page for an ArcGIS Engine application Sample
[C#]
PropertySheet.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using System.Runtime.Remoting;
using System.Runtime.InteropServices;
using ESRI.ArcGIS.Carto;
namespace SymbolSelector
{
//delegate for the OnFeatureLayerRendererChanged event
public delegate void FeatureLayerRendererChanged(object sender, EventArgs args);
/// <summary>
/// PropertySheet class which serves as the manager for the PropertyPages
/// </summary>
[Guid("1065420E-E725-4109-A038-66201784DFB9")]
[ComVisible(true)]
[ProgId("SymbolSelector.PropertySheet")]
[ClassInterface(ClassInterfaceType.None)]
public partial class PropertySheet : UserControl, IProvideObjectHandle, ISpecifyPropertyPages
{
private IFeatureLayer m_featureLayer;
//an event which gets fired when the page has applied change to the layer's renderer
public event FeatureLayerRendererChanged OnFeatureLayerRendererChanged;
#region Constructor
public PropertySheet()
{
InitializeComponent();
}
#endregion
#region IProvideObjectHandle Members
/// <summary>
/// Wraps marshal-by-value object references, allowing them to be returned through an indirection.
/// </summary>
public System.Runtime.Remoting.ObjectHandle ObjectHandle
{
get { return new ObjectHandle(this); }
}
#endregion
#region ISpecifyPropertyPages Members
/// <summary>
/// ills an array of CLSIDs for each property page that can be displayed in this object's property sheet.
/// </summary>
/// <param name="pPages">Pointer to a caller-allocated CAUUID structure that must be initialized and filled before returning.</param>
public void GetPages(ref CAUUID pPages)
{
Guid[] g = new Guid[1];
g[0] = typeof(SymbolSelectorPropPage).GUID;
pPages.SetPages(g);
}
#endregion
/// <summary>
/// the FeatureLayer which connects the PropertySheet to the actual layer
/// </summary>
public IFeatureLayer FeatureLayer
{
get { return m_featureLayer; }
set { m_featureLayer = value; }
}
/// <summary>
/// Fires an event to notify the listener that the layer's renderer has been changed
/// </summary>
public void FireFeatureLayerRendererChanged()
{
if (null != OnFeatureLayerRendererChanged)
OnFeatureLayerRendererChanged(this, new EventArgs());
}
}
}
[Visual Basic .NET]
PropertySheet.vb
Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Drawing
Imports System.Data
Imports System.Text
Imports System.Windows.Forms
Imports System.Runtime.Remoting
Imports System.Runtime.InteropServices
Imports ESRI.ArcGIS.Carto
Namespace SymbolSelector
'delegate for the OnFeatureLayerRendererChanged event
Public Delegate Sub FeatureLayerRendererChanged(ByVal sender As Object, ByVal args As EventArgs)
''' <summary>
''' PropertySheet class which serves as the manager for the PropertyPages
''' </summary>
<Guid("1065420E-E725-4109-A038-66201784DFB9"), ComVisible(True), ProgId("SymbolSelector.PropertySheet"), ClassInterface(ClassInterfaceType.None)> _
Public Partial Class PropertySheet : Inherits UserControl : Implements IProvideObjectHandle, ISpecifyPropertyPages
Private m_featureLayer As IFeatureLayer
'an event which gets fired when the page has applied change to the layer's renderer
Public Event OnFeatureLayerRendererChanged As FeatureLayerRendererChanged
#Region "Constructor"
Public Sub New()
InitializeComponent()
End Sub
#End Region
#Region "IProvideObjectHandle Members"
''' <summary>
''' Wraps marshal-by-value object references, allowing them to be returned through an indirection.
''' </summary>
Public ReadOnly Property ObjectHandle() As System.Runtime.Remoting.ObjectHandle Implements IProvideObjectHandle.ObjectHandle
Get
Return New ObjectHandle(Me)
End Get
End Property
#End Region
#Region "ISpecifyPropertyPages Members"
''' <summary>
''' ills an array of CLSIDs for each property page that can be displayed in this object's property sheet.
''' </summary>
''' <param name="pPages">Pointer to a caller-allocated CAUUID structure that must be initialized and filled before returning.</param>
Public Sub GetPages(ByRef pPages As CAUUID) Implements ISpecifyPropertyPages.GetPages
Dim g As Guid() = New Guid(0){}
g(0) = GetType(SymbolSelectorPropPage).GUID
pPages.SetPages(g)
End Sub
#End Region
''' <summary>
''' the FeatureLayer which connects the PropertySheet to the actual layer
''' </summary>
Public Property FeatureLayer() As IFeatureLayer
Get
Return m_featureLayer
End Get
Set
m_featureLayer = Value
End Set
End Property
''' <summary>
''' Fires an event to notify the listener that the layer's renderer has been changed
''' </summary>
Public Sub FireFeatureLayerRendererChanged()
If Not Nothing Is OnFeatureLayerRendererChangedEvent Then
RaiseEvent OnFeatureLayerRendererChanged(Me, New EventArgs())
End If
End Sub
End Class
End Namespace