ArcObjects Library Reference  

PropPageForm

About the Multivariate renderer Sample

[C#]

PropPageForm.cs


using System;
using System.Collections;
using System.Data;
using System.Diagnostics;

using ESRI.ArcGIS.Framework;
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.CartoUI;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.Geodatabase;
using ESRI.ArcGIS.Geometry;

namespace MultivariateRenderers
{
	public class PropPageForm : System.Windows.Forms.Form
	{

		private enum eRendererType: int
		{
			eShapePattern,
			eColor,
			eSize
		}

		private bool m_PageIsDirty = false;
		private IComPropertyPageSite m_pSite;
		private IMap m_pMap;
		private IGeoFeatureLayer m_pCurrentLayer;
		private IFeatureRenderer m_pRend;

		private IFeatureRenderer[] m_pShapePatternRendList;
		private IFeatureRenderer[] m_pColorRendList; // we could have separate lists for hue, sat/val, etc, but keep it simple for now
		private IFeatureRenderer[] m_pSizeRendList;

		private EColorCombinationType m_eColorCombinationMethod;
		private IFeatureRenderer m_pShapePatternRend;
		private IFeatureRenderer m_pColorRend1;
		private IFeatureRenderer m_pColorRend2;
		private IFeatureRenderer m_pSizeRend;


	#region  Windows Form Designer generated code 

		public PropPageForm() : base()
		{

			//This call is required by the Windows Form Designer.
			InitializeComponent();

			//Add any initialization after the InitializeComponent() call

		}

		//Form overrides dispose to clean up the component list.
		protected override void Dispose(bool disposing)
		{
			if (disposing)
			{
				if (components != null)
					components.Dispose();
			}
			base.Dispose(disposing);
		}

		//Required by the Windows Form Designer
		private System.ComponentModel.IContainer components;

		//NOTE: The following procedure is required by the Windows Form Designer
		//It can be modified using the Windows Form Designer.  
		//Do not modify it using the code editor.
		internal System.Windows.Forms.ComboBox cboShapePattern;
		internal System.Windows.Forms.ComboBox cboHue;
		internal System.Windows.Forms.CheckBox chkShapePattern;
		internal System.Windows.Forms.CheckBox chkColor;
		internal System.Windows.Forms.RadioButton radComponents;
		internal System.Windows.Forms.Label lblHue;
		internal System.Windows.Forms.Label lblPrimaryColor;
		internal System.Windows.Forms.RadioButton radCombination;
		internal System.Windows.Forms.ComboBox cboPrimaryColor;
		internal System.Windows.Forms.ComboBox cboSatValue;
		internal System.Windows.Forms.Label lblSatValue;
		internal System.Windows.Forms.Label lblSecondaryColor;
		internal System.Windows.Forms.ComboBox cboSecondaryColor;
		internal System.Windows.Forms.CheckBox chkSize;
		internal System.Windows.Forms.ComboBox cboSize;
        internal System.Windows.Forms.CheckBox chkRotation;
        internal System.Windows.Forms.Button butRotation;
		internal System.Windows.Forms.ComboBox cboSize1;
		[System.Diagnostics.DebuggerStepThrough()]
		private void InitializeComponent()
		{
            this.cboShapePattern = new System.Windows.Forms.ComboBox();
            this.cboHue = new System.Windows.Forms.ComboBox();
            this.chkShapePattern = new System.Windows.Forms.CheckBox();
            this.chkColor = new System.Windows.Forms.CheckBox();
            this.radComponents = new System.Windows.Forms.RadioButton();
            this.lblHue = new System.Windows.Forms.Label();
            this.lblPrimaryColor = new System.Windows.Forms.Label();
            this.radCombination = new System.Windows.Forms.RadioButton();
            this.cboPrimaryColor = new System.Windows.Forms.ComboBox();
            this.cboSatValue = new System.Windows.Forms.ComboBox();
            this.lblSatValue = new System.Windows.Forms.Label();
            this.lblSecondaryColor = new System.Windows.Forms.Label();
            this.cboSecondaryColor = new System.Windows.Forms.ComboBox();
            this.chkSize = new System.Windows.Forms.CheckBox();
            this.chkRotation = new System.Windows.Forms.CheckBox();
            this.butRotation = new System.Windows.Forms.Button();
            this.cboSize1 = new System.Windows.Forms.ComboBox();
            this.SuspendLayout();
            // 
            // cboShapePattern
            // 
            this.cboShapePattern.Location = new System.Drawing.Point(224, 11);
            this.cboShapePattern.Name = "cboShapePattern";
            this.cboShapePattern.Size = new System.Drawing.Size(121, 21);
            this.cboShapePattern.TabIndex = 24;
            this.cboShapePattern.SelectedIndexChanged += new System.EventHandler(this.cboShapePattern_SelectedIndexChanged);
            // 
            // cboHue
            // 
            this.cboHue.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.cboHue.Enabled = false;
            this.cboHue.Location = new System.Drawing.Point(224, 48);
            this.cboHue.Name = "cboHue";
            this.cboHue.Size = new System.Drawing.Size(192, 21);
            this.cboHue.TabIndex = 5;
            this.cboHue.EnabledChanged += new System.EventHandler(this.cboHue_EnabledChanged);
            this.cboHue.SelectedIndexChanged += new System.EventHandler(this.cboHue_SelectedIndexChanged);
            // 
            // chkShapePattern
            // 
            this.chkShapePattern.Location = new System.Drawing.Point(8, 8);
            this.chkShapePattern.Name = "chkShapePattern";
            this.chkShapePattern.Size = new System.Drawing.Size(152, 24);
            this.chkShapePattern.TabIndex = 6;
            this.chkShapePattern.Text = "Shape/Pattern";
            this.chkShapePattern.CheckedChanged += new System.EventHandler(this.chkShapePattern_CheckedChanged);
            // 
            // chkColor
            // 
            this.chkColor.Location = new System.Drawing.Point(8, 32);
            this.chkColor.Name = "chkColor";
            this.chkColor.Size = new System.Drawing.Size(152, 24);
            this.chkColor.TabIndex = 7;
            this.chkColor.Text = "Color";
            this.chkColor.CheckedChanged += new System.EventHandler(this.chkColor_CheckedChanged);
            // 
            // radComponents
            // 
            this.radComponents.Enabled = false;
            this.radComponents.Location = new System.Drawing.Point(24, 56);
            this.radComponents.Name = "radComponents";
            this.radComponents.Size = new System.Drawing.Size(128, 24);
            this.radComponents.TabIndex = 8;
            this.radComponents.Text = "Color Components";
            this.radComponents.CheckedChanged += new System.EventHandler(this.radComponents_CheckedChanged);
            this.radComponents.EnabledChanged += new System.EventHandler(this.radComponents_EnabledChanged);
            // 
            // lblHue
            // 
            this.lblHue.Enabled = false;
            this.lblHue.Location = new System.Drawing.Point(136, 48);
            this.lblHue.Name = "lblHue";
            this.lblHue.Size = new System.Drawing.Size(88, 24);
            this.lblHue.TabIndex = 9;
            this.lblHue.Text = "Hue";
            // 
            // lblPrimaryColor
            // 
            this.lblPrimaryColor.Enabled = false;
            this.lblPrimaryColor.Location = new System.Drawing.Point(136, 104);
            this.lblPrimaryColor.Name = "lblPrimaryColor";
            this.lblPrimaryColor.Size = new System.Drawing.Size(88, 24);
            this.lblPrimaryColor.TabIndex = 12;
            this.lblPrimaryColor.Text = "Color 1";
            // 
            // radCombination
            // 
            this.radCombination.Enabled = false;
            this.radCombination.Location = new System.Drawing.Point(24, 112);
            this.radCombination.Name = "radCombination";
            this.radCombination.Size = new System.Drawing.Size(128, 24);
            this.radCombination.TabIndex = 11;
            this.radCombination.Text = "Color Combination";
            this.radCombination.CheckedChanged += new System.EventHandler(this.radCombination_CheckedChanged);
            this.radCombination.EnabledChanged += new System.EventHandler(this.radCombination_EnabledChanged);
            // 
            // cboPrimaryColor
            // 
            this.cboPrimaryColor.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.cboPrimaryColor.Enabled = false;
            this.cboPrimaryColor.Location = new System.Drawing.Point(224, 104);
            this.cboPrimaryColor.Name = "cboPrimaryColor";
            this.cboPrimaryColor.Size = new System.Drawing.Size(192, 21);
            this.cboPrimaryColor.TabIndex = 10;
            this.cboPrimaryColor.EnabledChanged += new System.EventHandler(this.cboPrimaryColor_EnabledChanged);
            this.cboPrimaryColor.SelectedIndexChanged += new System.EventHandler(this.cboPrimaryColor_SelectedIndexChanged);
            // 
            // cboSatValue
            // 
            this.cboSatValue.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.cboSatValue.Enabled = false;
            this.cboSatValue.Location = new System.Drawing.Point(224, 72);
            this.cboSatValue.Name = "cboSatValue";
            this.cboSatValue.Size = new System.Drawing.Size(192, 21);
            this.cboSatValue.TabIndex = 13;
            this.cboSatValue.EnabledChanged += new System.EventHandler(this.cboSatValue_EnabledChanged);
            this.cboSatValue.SelectedIndexChanged += new System.EventHandler(this.cboSatValue_selectedIndexChanged);
            // 
            // lblSatValue
            // 
            this.lblSatValue.Enabled = false;
            this.lblSatValue.Location = new System.Drawing.Point(136, 72);
            this.lblSatValue.Name = "lblSatValue";
            this.lblSatValue.Size = new System.Drawing.Size(88, 24);
            this.lblSatValue.TabIndex = 14;
            this.lblSatValue.Text = "Saturation/Value";
            // 
            // lblSecondaryColor
            // 
            this.lblSecondaryColor.Enabled = false;
            this.lblSecondaryColor.Location = new System.Drawing.Point(136, 128);
            this.lblSecondaryColor.Name = "lblSecondaryColor";
            this.lblSecondaryColor.Size = new System.Drawing.Size(88, 24);
            this.lblSecondaryColor.TabIndex = 16;
            this.lblSecondaryColor.Text = "Color 2";
            // 
            // cboSecondaryColor
            // 
            this.cboSecondaryColor.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.cboSecondaryColor.Enabled = false;
            this.cboSecondaryColor.Location = new System.Drawing.Point(224, 128);
            this.cboSecondaryColor.Name = "cboSecondaryColor";
            this.cboSecondaryColor.Size = new System.Drawing.Size(192, 21);
            this.cboSecondaryColor.TabIndex = 15;
            this.cboSecondaryColor.EnabledChanged += new System.EventHandler(this.cboSecondaryColor_EnabledChanged);
            this.cboSecondaryColor.SelectedIndexChanged += new System.EventHandler(this.cboSecondaryColor_SelectedIndexChanged);
            // 
            // chkSize
            // 
            this.chkSize.Location = new System.Drawing.Point(8, 160);
            this.chkSize.Name = "chkSize";
            this.chkSize.Size = new System.Drawing.Size(152, 24);
            this.chkSize.TabIndex = 18;
            this.chkSize.Text = "Size";
            this.chkSize.CheckedChanged += new System.EventHandler(this.chkSize_CheckedChanged);
            // 
            // chkRotation
            // 
            this.chkRotation.Location = new System.Drawing.Point(8, 192);
            this.chkRotation.Name = "chkRotation";
            this.chkRotation.Size = new System.Drawing.Size(152, 24);
            this.chkRotation.TabIndex = 19;
            this.chkRotation.Text = "Rotation";
            this.chkRotation.CheckedChanged += new System.EventHandler(this.chkRotation_CheckedChanged);
            // 
            // butRotation
            // 
            this.butRotation.Enabled = false;
            this.butRotation.Location = new System.Drawing.Point(224, 192);
            this.butRotation.Name = "butRotation";
            this.butRotation.Size = new System.Drawing.Size(192, 24);
            this.butRotation.TabIndex = 21;
            this.butRotation.Text = "Properties";
            this.butRotation.Click += new System.EventHandler(this.butRotation_Click);
            // 
            // cboSize1
            // 
            this.cboSize1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.cboSize1.Enabled = false;
            this.cboSize1.Location = new System.Drawing.Point(224, 160);
            this.cboSize1.Name = "cboSize1";
            this.cboSize1.Size = new System.Drawing.Size(192, 21);
            this.cboSize1.TabIndex = 23;
            this.cboSize1.SelectedIndexChanged += new System.EventHandler(this.cboSize1_selectedindexchanged);
            // 
            // PropPageForm
            // 
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.ClientSize = new System.Drawing.Size(424, 285);
            this.Controls.Add(this.cboSize1);
            this.Controls.Add(this.butRotation);
            this.Controls.Add(this.chkRotation);
            this.Controls.Add(this.chkSize);
            this.Controls.Add(this.lblSecondaryColor);
            this.Controls.Add(this.cboSecondaryColor);
            this.Controls.Add(this.lblSatValue);
            this.Controls.Add(this.cboSatValue);
            this.Controls.Add(this.lblPrimaryColor);
            this.Controls.Add(this.radCombination);
            this.Controls.Add(this.cboPrimaryColor);
            this.Controls.Add(this.lblHue);
            this.Controls.Add(this.radComponents);
            this.Controls.Add(this.chkColor);
            this.Controls.Add(this.chkShapePattern);
            this.Controls.Add(this.cboHue);
            this.Controls.Add(this.cboShapePattern);
            this.Name = "PropPageForm";
            this.Text = "ColorPropPageForm";
            this.Load += new System.EventHandler(this.PropPageForm_Load);
            this.ResumeLayout(false);

		}

	#endregion

		public bool IsDirty
		{
			get
			{
				return m_PageIsDirty;
			}
		}

		public IComPropertyPageSite PageSite
		{
			set
			{
				m_pSite = value;
			}
		}

		public void InitControls(IMultivariateRenderer pMultiRend, IMap pMap, IGeoFeatureLayer pGeoLayer)
		{
			// copy properties from the renderer and map to the form

			m_eColorCombinationMethod = pMultiRend.ColorCombinationMethod;
			m_pShapePatternRend = pMultiRend.ShapePatternRend;
			m_pColorRend1 = pMultiRend.ColorRend1;
			m_pColorRend2 = pMultiRend.ColorRend2;
			m_pSizeRend = pMultiRend.SizeRend;

			if (m_pShapePatternRend != null)
			{
				chkShapePattern.CheckState = System.Windows.Forms.CheckState.Checked;
				cboShapePattern.Enabled = true;
			}

			if (m_eColorCombinationMethod == EColorCombinationType.enuComponents)
			{
				radComponents.Checked = true;
				radCombination.Checked = false;
				UpdateColorComb();

			}
			else
			{
                //disabled
                //radComponents.Checked = false;
                //radCombination.Checked = true;

                radComponents.Checked = true;
                radCombination.Checked = false;
				UpdateColorComb();

			}

			if (m_pColorRend1 != null)
			{
				chkColor.CheckState = System.Windows.Forms.CheckState.Checked;
				radComponents.Enabled = true;
                //disabled
                //radCombination.Enabled = true;
                radCombination.Enabled = false;

			}
			if (m_pSizeRend != null)
			{
				chkSize.CheckState = System.Windows.Forms.CheckState.Checked;
				cboSize1.Enabled = true;
			}

			IRotationRenderer pRotRend = null;
			pRotRend = pMultiRend as IRotationRenderer;
			if (pRotRend.RotationField != "")
			{
				chkRotation.CheckState = System.Windows.Forms.CheckState.Checked;
				butRotation.Enabled = true;
			}

            //ITransparencyRenderer pTransRend = null;
            //pTransRend = pMultiRend as ITransparencyRenderer;
            //if (pTransRend.TransparencyField != "")
            //{
            //    chkTransparency.CheckState = System.Windows.Forms.CheckState.Checked;
            //    butTransparency.Enabled = true;
            //}

			m_pMap = pMap;
			m_pCurrentLayer = pGeoLayer;
			m_pRend = pMultiRend as IFeatureRenderer; // we need this object to support the root transparency dialogs

			m_PageIsDirty = false;
		}

		public void InitRenderer(IMultivariateRenderer pMultiRend)
		{
			// copy properties from the form to the renderer

			if (chkShapePattern.CheckState == System.Windows.Forms.CheckState.Checked)
				pMultiRend.ShapePatternRend = m_pShapePatternRend;
			else
				pMultiRend.ShapePatternRend = null;

			if (chkColor.CheckState == System.Windows.Forms.CheckState.Checked)
			{
				pMultiRend.ColorRend1 = m_pColorRend1;
				pMultiRend.ColorRend2 = m_pColorRend2;
				pMultiRend.ColorCombinationMethod = m_eColorCombinationMethod;
			}
			else
			{
				pMultiRend.ColorRend1 = null;
				pMultiRend.ColorRend2 = null;
				pMultiRend.ColorCombinationMethod = EColorCombinationType.enuCIELabMatrix; // default (?)
			}

			if (chkSize.CheckState == System.Windows.Forms.CheckState.Checked)
				pMultiRend.SizeRend = m_pSizeRend;
			else
				pMultiRend.SizeRend = null;

			IRotationRenderer pRotRend = null;
			IRotationRenderer pFormRotRend = null;
			pRotRend = pMultiRend as IRotationRenderer;
			if (chkRotation.CheckState == System.Windows.Forms.CheckState.Checked)
			{
				pFormRotRend = m_pRend as IRotationRenderer;
				pRotRend.RotationField = pFormRotRend.RotationField;
				pRotRend.RotationType = pFormRotRend.RotationType;
			}
			else
			{
				pRotRend.RotationField = "";
				pRotRend.RotationType = esriSymbolRotationType.esriRotateSymbolArithmetic; // default (?)
			}

            //ITransparencyRenderer pTransRend = null;
            //ITransparencyRenderer pFormTransRend = null;
            //pTransRend = pMultiRend as ITransparencyRenderer;
            //if (chkTransparency.CheckState == System.Windows.Forms.CheckState.Checked)
            //{
            //    pFormTransRend = m_pRend as ITransparencyRenderer;
            //    pTransRend.TransparencyField = pFormTransRend.TransparencyField;
            //}
            //else
            //    pTransRend.TransparencyField = "";


		}

		private void PropPageForm_Load(object sender, System.EventArgs e)
		{
			// initialize form controls from data members

			IEnumLayer pGeoLayers = null;
			UID pUID = new UID();
			pUID.Value = "{E156D7E5-22AF-11D3-9F99-00C04F6BC78E}";
			pGeoLayers = m_pMap.get_Layers(pUID, true);
			pGeoLayers.Reset();
			IGeoFeatureLayer pGeoLayer = null;
			IFeatureRenderer pFeatRend = null;
			int iColor = 0;
			int iShapePattern = 0;
			int iSize = 0;

			pGeoLayer = pGeoLayers.Next() as IGeoFeatureLayer;
			string sColor1 = "";
			string sColor2 = "";
			string sShapePattern = "";
			string sSize = "";

			while (pGeoLayer != null)
			{
				// to keep things simple, filter for layers with same feat class geometry (point, line, poly) as current layer
				if ((pGeoLayer.FeatureClass.ShapeType) == (m_pCurrentLayer.FeatureClass.ShapeType))
				{
					// filter out the current layer
					if (! (pGeoLayer == m_pCurrentLayer))
					{
						pFeatRend = pGeoLayer.Renderer;

						// filter for only layers currently assigned a renderer that is valid for each renderer type (shape, color, size)
						if (RendererIsValidForType(pFeatRend, eRendererType.eColor))
						{
							iColor = iColor + 1;
							System.Array.Resize(ref m_pColorRendList, iColor + 1);
							m_pColorRendList[iColor - 1] = pFeatRend;

							cboHue.Items.Add(pGeoLayer.Name);
							cboSatValue.Items.Add(pGeoLayer.Name);
							cboPrimaryColor.Items.Add(pGeoLayer.Name);
							cboSecondaryColor.Items.Add(pGeoLayer.Name);


							if (CompareRenderers(pGeoLayer.Renderer, m_pColorRend1))
									sColor1 = pGeoLayer.Name;
							if (CompareRenderers(pGeoLayer.Renderer, m_pColorRend2))
									sColor2 = pGeoLayer.Name;
						}

						if (RendererIsValidForType(pFeatRend, eRendererType.eShapePattern))
						{
							iShapePattern = iShapePattern + 1;
							System.Array.Resize(ref m_pShapePatternRendList, iShapePattern + 1);
							m_pShapePatternRendList[iShapePattern - 1] = pFeatRend;

							cboShapePattern.Items.Add(pGeoLayer.Name);

                            //if (pGeoLayer.Renderer == m_pShapePatternRend)
                            //        sShapePattern = pGeoLayer.Name;
                            if (CompareRenderers(pGeoLayer.Renderer, m_pShapePatternRend))
                                sShapePattern = pGeoLayer.Name;
						}

						if (RendererIsValidForType(pFeatRend, eRendererType.eSize))
						{
							iSize = iSize + 1;
							System.Array.Resize(ref m_pSizeRendList, iSize + 1);
							m_pSizeRendList[iSize - 1] = pFeatRend;

							cboSize1.Items.Add(pGeoLayer.Name);

                            //if (pGeoLayer.Renderer == m_pSizeRend)
                            //        sSize = pGeoLayer.Name;
                            if (CompareRenderers(pGeoLayer.Renderer, m_pSizeRend))
                                sSize = pGeoLayer.Name;
						}

					}
				}
				pGeoLayer = pGeoLayers.Next() as IGeoFeatureLayer;
			}

			// select correct items in combos
			cboShapePattern.Text = sShapePattern;
			if (radComponents.Checked)
			{
				cboHue.Text = sColor1;
				cboSatValue.Text = sColor2;
			}
			else
			{
				cboPrimaryColor.Text = sColor1;
				cboSecondaryColor.Text = sColor2;
			}
			cboSize1.Text = sSize;

			// disable if there aren't any layers in the map of the correct type
			if (iShapePattern <= 0)
					cboShapePattern.Enabled = false;

			if (iColor <= 0)
			{
				if (radComponents.Checked)
				{
					cboHue.Enabled = false;
					cboSatValue.Enabled = false;
				}
				else
				{
					cboPrimaryColor.Enabled = false;
					cboSecondaryColor.Enabled = false;
				}
			}

			if (iSize <= 0)
					cboSize1.Enabled = false;
		}

		private void cboShapePattern_SelectedIndexChanged(object sender, System.EventArgs e)
		{
			m_pShapePatternRend = m_pShapePatternRendList[cboShapePattern.SelectedIndex];
			if (m_pSite != null)
					m_pSite.PageChanged();
			m_PageIsDirty = true;
		}

		private void cboHue_SelectedIndexChanged(object sender, System.EventArgs e)
		{
			m_pColorRend1 = m_pColorRendList[cboHue.SelectedIndex];
			if (m_pSite != null)
					m_pSite.PageChanged();
			m_PageIsDirty = true;
		}

		private void cboSatValue_selectedIndexChanged(object sender, System.EventArgs e)
		{
			m_pColorRend2 = m_pColorRendList[cboSatValue.SelectedIndex];
			if (m_pSite != null)
					m_pSite.PageChanged();
			m_PageIsDirty = true;
		}

		private void cboPrimaryColor_SelectedIndexChanged(object sender, System.EventArgs e)
		{
			m_pColorRend1 = m_pColorRendList[cboPrimaryColor.SelectedIndex];
			if (m_pSite != null)
					m_pSite.PageChanged();
			m_PageIsDirty = true;
		}

		private void cboSecondaryColor_SelectedIndexChanged(object sender, System.EventArgs e)
		{
			m_pColorRend2 = m_pColorRendList[cboSecondaryColor.SelectedIndex];
			if (m_pSite != null)
					m_pSite.PageChanged();
			m_PageIsDirty = true;
		}

		private void cboSize1_selectedindexchanged(object sender, System.EventArgs e)
		{
			m_pSizeRend = m_pSizeRendList[cboSize1.SelectedIndex];
			if (m_pSite != null)
					m_pSite.PageChanged();
			m_PageIsDirty = true;
		}

		private void radComponents_CheckedChanged(object sender, System.EventArgs e)
		{
			UpdateColorComb();
		}

		private void radCombination_CheckedChanged(object sender, System.EventArgs e)
		{
			UpdateColorComb();
		}

		private void UpdateColorComb()
		{

			if (radComponents.Checked)
			{
				m_eColorCombinationMethod = EColorCombinationType.enuComponents;

				cboHue.Enabled = true;
				cboSatValue.Enabled = true;
				cboPrimaryColor.Enabled = false;
				cboSecondaryColor.Enabled = false;
			}
			else
			{
				m_eColorCombinationMethod = EColorCombinationType.enuCIELabMatrix;

				cboHue.Enabled = false;
				cboSatValue.Enabled = false;
				cboPrimaryColor.Enabled = true;
				cboSecondaryColor.Enabled = true;
			}

			if (m_pSite != null)
					m_pSite.PageChanged();
			m_PageIsDirty = true;

		}

		private bool RendererIsValidForType(IFeatureRenderer pFeatRend, eRendererType eMultiRendType)
		{
			// indicates whether or not pFeatRend is valid for the eMultiRendType for the current layer
			// e.g. if pFeatRend is an IProportionalSymbolRenderer, then it's valid for eMultiRendType = eSize 

			ILegendInfo pLegendInfo = null;

			if (eMultiRendType == eRendererType.eShapePattern)
				return pFeatRend is IUniqueValueRenderer;
			else if (eMultiRendType == eRendererType.eColor)
			{
				pLegendInfo = pFeatRend as ILegendInfo;
				return (pFeatRend is IUniqueValueRenderer) | (pFeatRend is IClassBreaksRenderer & ! pLegendInfo.SymbolsAreGraduated);
			}
			else // size
			{
				pLegendInfo = pFeatRend as ILegendInfo;
				return (pFeatRend is IClassBreaksRenderer & pLegendInfo.SymbolsAreGraduated) | (pFeatRend is IProportionalSymbolRenderer);
			}


		}

		private void butRotation_Click(object sender, System.EventArgs e)
		{
			IRendererUIDialog2 pRendUIDlg2 = null;
			pRendUIDlg2 = new MarkerRotationDialog() as IRendererUIDialog2;
			pRendUIDlg2.FeatureLayer = m_pCurrentLayer;
			pRendUIDlg2.Renderer = m_pRend;
			SecondaryForm pMyForm = null;
			pMyForm = new SecondaryForm();
			pRendUIDlg2.DoModal(pMyForm.Handle.ToInt32());

		}

		private void chkShapePattern_CheckedChanged(object sender, System.EventArgs e)
		{
			cboShapePattern.Enabled = (chkShapePattern.CheckState == System.Windows.Forms.CheckState.Checked);
			if (m_pSite != null)
					m_pSite.PageChanged();
			m_PageIsDirty = true;
		}

		private void chkColor_CheckedChanged(object sender, System.EventArgs e)
		{
			radComponents.Enabled = (chkColor.CheckState == System.Windows.Forms.CheckState.Checked);
            //radCombination.Enabled = (chkColor.CheckState == System.Windows.Forms.CheckState.Checked);
            radCombination.Enabled = false;

			if (m_pSite != null)
					m_pSite.PageChanged();
			m_PageIsDirty = true;
		}

		private void chkSize_CheckedChanged(object sender, System.EventArgs e)
		{
			cboSize1.Enabled = (chkSize.CheckState == System.Windows.Forms.CheckState.Checked);
			if (m_pSite != null)
					m_pSite.PageChanged();
			m_PageIsDirty = true;
		}


		private void chkRotation_CheckedChanged(object sender, System.EventArgs e)
		{
			butRotation.Enabled = (chkRotation.CheckState == System.Windows.Forms.CheckState.Checked);
			if (m_pSite != null)
					m_pSite.PageChanged();
			m_PageIsDirty = true;
		}

        //private void chkTransparency_CheckedChanged(object sender, System.EventArgs e)
        //{
        //    butTransparency.Enabled = (chkTransparency.CheckState == System.Windows.Forms.CheckState.Checked);
        //    if (m_pSite != null)
        //            m_pSite.PageChanged();
        //    m_PageIsDirty = true;
        //}

		private void radComponents_EnabledChanged(object sender, System.EventArgs e)
		{

			cboHue.Enabled = radComponents.Enabled & radComponents.Checked;
			cboSatValue.Enabled = radComponents.Enabled & radComponents.Checked;
		}

		private void radCombination_EnabledChanged(object sender, System.EventArgs e)
		{
            //disabled
            //cboPrimaryColor.Enabled = radCombination.Enabled & radCombination.Checked;
            //cboSecondaryColor.Enabled = radCombination.Enabled & radCombination.Checked;
            cboPrimaryColor.Enabled = false;
            cboSecondaryColor.Enabled = false;
		}

		private void cboHue_EnabledChanged(object sender, System.EventArgs e)
		{

			lblHue.Enabled = cboHue.Enabled;
		}

		private void cboSatValue_EnabledChanged(object sender, System.EventArgs e)
		{

			lblSatValue.Enabled = cboSatValue.Enabled;
		}

		private void cboPrimaryColor_EnabledChanged(object sender, System.EventArgs e)
		{

			lblPrimaryColor.Enabled = cboPrimaryColor.Enabled;
		}

		private void cboSecondaryColor_EnabledChanged(object sender, System.EventArgs e)
		{

			lblSecondaryColor.Enabled = cboSecondaryColor.Enabled;
		}

		private bool CompareRenderers(IFeatureRenderer pRend, IFeatureRenderer pCheckRend)
		{

			if (pRend is IClassBreaksRenderer)
			{
				// type
				if (! (pCheckRend is IClassBreaksRenderer))
						return false;

				IClassBreaksRenderer pCBRend = null;
				pCBRend = pRend as IClassBreaksRenderer;
				IClassBreaksRenderer pCBCheckRend = null;
				pCBCheckRend = pCheckRend as IClassBreaksRenderer;

				// break count
				if (pCBRend.BreakCount != pCBCheckRend.BreakCount)
						return false;

				// field
				if (pCBRend.Field != pCBCheckRend.Field)
						return false;

			}

			return true;

		}
	}
} //end of root namespace
[Visual Basic .NET]

PropPageForm.vb

Imports ESRI.ArcGIS.Framework
Imports ESRI.ArcGIS.Carto
Imports ESRI.ArcGIS.CartoUI
Imports ESRI.ArcGIS.esriSystem
Imports ESRI.ArcGIS.Geodatabase
Imports ESRI.ArcGIS.Geometry

Public Class PropPageForm
    Inherits System.Windows.Forms.Form

    Private Enum eRendererType
        eShapePattern
        eColor
        eSize
    End Enum

    Private m_PageIsDirty As Boolean = False
    Private m_pSite As IComPropertyPageSite
    Private m_pMap As IMap
    Private m_pCurrentLayer As IGeoFeatureLayer
    Private m_pRend As IFeatureRenderer

    Private m_pShapePatternRendList() As IFeatureRenderer
    Private m_pColorRendList() As IFeatureRenderer
    Private m_pSizeRendList() As IFeatureRenderer

    Private m_eColorCombinationMethod As EColorCombinationType
    Private m_pShapePatternRend As IFeatureRenderer
    Private m_pColorRend1 As IFeatureRenderer
    Private m_pColorRend2 As IFeatureRenderer
    Private m_pSizeRend As IFeatureRenderer


#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents cboShapePattern As System.Windows.Forms.ComboBox
    Friend WithEvents cboHue As System.Windows.Forms.ComboBox
    Friend WithEvents chkShapePattern As System.Windows.Forms.CheckBox
    Friend WithEvents chkColor As System.Windows.Forms.CheckBox
    Friend WithEvents radComponents As System.Windows.Forms.RadioButton
    Friend WithEvents lblHue As System.Windows.Forms.Label
    Friend WithEvents lblPrimaryColor As System.Windows.Forms.Label
    Friend WithEvents radCombination As System.Windows.Forms.RadioButton
    Friend WithEvents cboPrimaryColor As System.Windows.Forms.ComboBox
    Friend WithEvents cboSatValue As System.Windows.Forms.ComboBox
    Friend WithEvents lblSatValue As System.Windows.Forms.Label
    Friend WithEvents lblSecondaryColor As System.Windows.Forms.Label
    Friend WithEvents cboSecondaryColor As System.Windows.Forms.ComboBox
    Friend WithEvents chkSize As System.Windows.Forms.CheckBox
    Friend WithEvents cboSize As System.Windows.Forms.ComboBox
    Friend WithEvents chkRotation As System.Windows.Forms.CheckBox
    Friend WithEvents butRotation As System.Windows.Forms.Button
    Friend WithEvents cboSize1 As System.Windows.Forms.ComboBox
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.cboShapePattern = New System.Windows.Forms.ComboBox
        Me.cboHue = New System.Windows.Forms.ComboBox
        Me.chkShapePattern = New System.Windows.Forms.CheckBox
        Me.chkColor = New System.Windows.Forms.CheckBox
        Me.radComponents = New System.Windows.Forms.RadioButton
        Me.lblHue = New System.Windows.Forms.Label
        Me.lblPrimaryColor = New System.Windows.Forms.Label
        Me.radCombination = New System.Windows.Forms.RadioButton
        Me.cboPrimaryColor = New System.Windows.Forms.ComboBox
        Me.cboSatValue = New System.Windows.Forms.ComboBox
        Me.lblSatValue = New System.Windows.Forms.Label
        Me.lblSecondaryColor = New System.Windows.Forms.Label
        Me.cboSecondaryColor = New System.Windows.Forms.ComboBox
        Me.chkSize = New System.Windows.Forms.CheckBox
        Me.chkRotation = New System.Windows.Forms.CheckBox
        Me.butRotation = New System.Windows.Forms.Button
        Me.cboSize1 = New System.Windows.Forms.ComboBox
        Me.SuspendLayout()
        '
        'cboShapePattern
        '
        Me.cboShapePattern.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cboShapePattern.Enabled = False
        Me.cboShapePattern.Location = New System.Drawing.Point(224, 8)
        Me.cboShapePattern.Name = "cboShapePattern"
        Me.cboShapePattern.Size = New System.Drawing.Size(192, 21)
        Me.cboShapePattern.TabIndex = 4
        '
        'cboHue
        '
        Me.cboHue.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cboHue.Enabled = False
        Me.cboHue.Location = New System.Drawing.Point(224, 48)
        Me.cboHue.Name = "cboHue"
        Me.cboHue.Size = New System.Drawing.Size(192, 21)
        Me.cboHue.TabIndex = 5
        '
        'chkShapePattern
        '
        Me.chkShapePattern.Location = New System.Drawing.Point(8, 8)
        Me.chkShapePattern.Name = "chkShapePattern"
        Me.chkShapePattern.Size = New System.Drawing.Size(152, 24)
        Me.chkShapePattern.TabIndex = 6
        Me.chkShapePattern.Text = "Shape/Pattern"
        '
        'chkColor
        '
        Me.chkColor.Location = New System.Drawing.Point(8, 32)
        Me.chkColor.Name = "chkColor"
        Me.chkColor.Size = New System.Drawing.Size(152, 24)
        Me.chkColor.TabIndex = 7
        Me.chkColor.Text = "Color"
        '
        'radComponents
        '
        Me.radComponents.Enabled = False
        Me.radComponents.Location = New System.Drawing.Point(24, 56)
        Me.radComponents.Name = "radComponents"
        Me.radComponents.Size = New System.Drawing.Size(128, 24)
        Me.radComponents.TabIndex = 8
        Me.radComponents.Text = "Color Components"
        '
        'lblHue
        '
        Me.lblHue.Enabled = False
        Me.lblHue.Location = New System.Drawing.Point(136, 48)
        Me.lblHue.Name = "lblHue"
        Me.lblHue.Size = New System.Drawing.Size(88, 24)
        Me.lblHue.TabIndex = 9
        Me.lblHue.Text = "Hue"
        '
        'lblPrimaryColor
        '
        Me.lblPrimaryColor.Enabled = False
        Me.lblPrimaryColor.Location = New System.Drawing.Point(136, 104)
        Me.lblPrimaryColor.Name = "lblPrimaryColor"
        Me.lblPrimaryColor.Size = New System.Drawing.Size(88, 24)
        Me.lblPrimaryColor.TabIndex = 12
        Me.lblPrimaryColor.Text = "Color 1"
        '
        'radCombination
        '
        Me.radCombination.Enabled = False
        Me.radCombination.Location = New System.Drawing.Point(24, 112)
        Me.radCombination.Name = "radCombination"
        Me.radCombination.Size = New System.Drawing.Size(128, 24)
        Me.radCombination.TabIndex = 11
        Me.radCombination.Text = "Color Combination"
        '
        'cboPrimaryColor
        '
        Me.cboPrimaryColor.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cboPrimaryColor.Enabled = False
        Me.cboPrimaryColor.Location = New System.Drawing.Point(224, 104)
        Me.cboPrimaryColor.Name = "cboPrimaryColor"
        Me.cboPrimaryColor.Size = New System.Drawing.Size(192, 21)
        Me.cboPrimaryColor.TabIndex = 10
        '
        'cboSatValue
        '
        Me.cboSatValue.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cboSatValue.Enabled = False
        Me.cboSatValue.Location = New System.Drawing.Point(224, 72)
        Me.cboSatValue.Name = "cboSatValue"
        Me.cboSatValue.Size = New System.Drawing.Size(192, 21)
        Me.cboSatValue.TabIndex = 13
        '
        'lblSatValue
        '
        Me.lblSatValue.Enabled = False
        Me.lblSatValue.Location = New System.Drawing.Point(136, 72)
        Me.lblSatValue.Name = "lblSatValue"
        Me.lblSatValue.Size = New System.Drawing.Size(88, 24)
        Me.lblSatValue.TabIndex = 14
        Me.lblSatValue.Text = "Saturation/Value"
        '
        'lblSecondaryColor
        '
        Me.lblSecondaryColor.Enabled = False
        Me.lblSecondaryColor.Location = New System.Drawing.Point(136, 128)
        Me.lblSecondaryColor.Name = "lblSecondaryColor"
        Me.lblSecondaryColor.Size = New System.Drawing.Size(88, 24)
        Me.lblSecondaryColor.TabIndex = 16
        Me.lblSecondaryColor.Text = "Color 2"
        '
        'cboSecondaryColor
        '
        Me.cboSecondaryColor.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cboSecondaryColor.Enabled = False
        Me.cboSecondaryColor.Location = New System.Drawing.Point(224, 128)
        Me.cboSecondaryColor.Name = "cboSecondaryColor"
        Me.cboSecondaryColor.Size = New System.Drawing.Size(192, 21)
        Me.cboSecondaryColor.TabIndex = 15
        '
        'chkSize
        '
        Me.chkSize.Location = New System.Drawing.Point(8, 160)
        Me.chkSize.Name = "chkSize"
        Me.chkSize.Size = New System.Drawing.Size(152, 24)
        Me.chkSize.TabIndex = 18
        Me.chkSize.Text = "Size"
        '
        'chkRotation
        '
        Me.chkRotation.Location = New System.Drawing.Point(8, 192)
        Me.chkRotation.Name = "chkRotation"
        Me.chkRotation.Size = New System.Drawing.Size(152, 24)
        Me.chkRotation.TabIndex = 19
        Me.chkRotation.Text = "Rotation"
        '
        'butRotation
        '
        Me.butRotation.Enabled = False
        Me.butRotation.Location = New System.Drawing.Point(224, 192)
        Me.butRotation.Name = "butRotation"
        Me.butRotation.Size = New System.Drawing.Size(192, 24)
        Me.butRotation.TabIndex = 21
        Me.butRotation.Text = "Properties"
        '
        'cboSize1
        '
        Me.cboSize1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cboSize1.Enabled = False
        Me.cboSize1.Location = New System.Drawing.Point(224, 160)
        Me.cboSize1.Name = "cboSize1"
        Me.cboSize1.Size = New System.Drawing.Size(192, 21)
        Me.cboSize1.TabIndex = 23
        '
        'PropPageForm
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(424, 285)
        Me.Controls.Add(Me.cboSize1)
        Me.Controls.Add(Me.butRotation)
        Me.Controls.Add(Me.chkRotation)
        Me.Controls.Add(Me.chkSize)
        Me.Controls.Add(Me.lblSecondaryColor)
        Me.Controls.Add(Me.cboSecondaryColor)
        Me.Controls.Add(Me.lblSatValue)
        Me.Controls.Add(Me.cboSatValue)
        Me.Controls.Add(Me.lblPrimaryColor)
        Me.Controls.Add(Me.radCombination)
        Me.Controls.Add(Me.cboPrimaryColor)
        Me.Controls.Add(Me.lblHue)
        Me.Controls.Add(Me.radComponents)
        Me.Controls.Add(Me.chkColor)
        Me.Controls.Add(Me.chkShapePattern)
        Me.Controls.Add(Me.cboHue)
        Me.Controls.Add(Me.cboShapePattern)
        Me.Name = "PropPageForm"
        Me.Text = "ColorPropPageForm"
        Me.ResumeLayout(False)

    End Sub

#End Region

    Public ReadOnly Property IsDirty() As Boolean
        Get
            Return m_PageIsDirty
        End Get
    End Property

    Public WriteOnly Property PageSite() As IComPropertyPageSite
        Set(ByVal Value As IComPropertyPageSite)
            m_pSite = Value
        End Set
    End Property

    Public Sub InitControls(ByVal pMultiRend As IMultivariateRenderer, ByVal pMap As IMap, ByVal pGeoLayer As IGeoFeatureLayer)

        m_eColorCombinationMethod = pMultiRend.ColorCombinationMethod
        m_pShapePatternRend = pMultiRend.ShapePatternRend
        m_pColorRend1 = pMultiRend.ColorRend1
        m_pColorRend2 = pMultiRend.ColorRend2
        m_pSizeRend = pMultiRend.SizeRend

        If Not m_pShapePatternRend Is Nothing Then
            chkShapePattern.CheckState = Windows.Forms.CheckState.Checked
            cboShapePattern.Enabled = True
        End If

        If m_eColorCombinationMethod = EColorCombinationType.enuComponents Then
            radComponents.Checked = True
            radCombination.Checked = False
            UpdateColorComb()

        Else
            'disabled
            'radComponents.Checked = False
            'radCombination.Checked = True
            radComponents.Checked = True
            radCombination.Checked = False
            'added to disable color combination
            m_eColorCombinationMethod = EColorCombinationType.enuComponents
            UpdateColorComb()

        End If

        If Not m_pColorRend1 Is Nothing Then
            chkColor.CheckState = Windows.Forms.CheckState.Checked
            radComponents.Enabled = True
            'disabled
            'radCombination.Enabled = True
            radCombination.Enabled = False

        End If
        If Not m_pSizeRend Is Nothing Then
            chkSize.CheckState = Windows.Forms.CheckState.Checked
            cboSize1.Enabled = True
        End If

        Dim pRotRend As IRotationRenderer
        pRotRend = pMultiRend
        If pRotRend.RotationField <> "" Then
            chkRotation.CheckState = Windows.Forms.CheckState.Checked
            butRotation.Enabled = True
        End If

        'Dim pTransRend As ITransparencyRenderer
        'pTransRend = pMultiRend
        'If pTransRend.TransparencyField <> "" Then
        'chkTransparency.CheckState = Windows.Forms.CheckState.Checked
        'butTransparency.Enabled = True
        'End If

        m_pMap = pMap
        m_pCurrentLayer = pGeoLayer
        m_pRend = pMultiRend         ' we need this object to support the root transparency dialogs

        m_PageIsDirty = False
    End Sub

    Public Sub InitRenderer(ByVal pMultiRend As IMultivariateRenderer)
        ' copy properties from the form to the renderer

        If chkShapePattern.CheckState = Windows.Forms.CheckState.Checked Then
            pMultiRend.ShapePatternRend = m_pShapePatternRend
        Else
            pMultiRend.ShapePatternRend = Nothing
        End If

        If chkColor.CheckState = Windows.Forms.CheckState.Checked Then
            pMultiRend.ColorRend1 = m_pColorRend1
            pMultiRend.ColorRend2 = m_pColorRend2
            pMultiRend.ColorCombinationMethod = m_eColorCombinationMethod
        Else
            pMultiRend.ColorRend1 = Nothing
            pMultiRend.ColorRend2 = Nothing
            pMultiRend.ColorCombinationMethod = EColorCombinationType.enuCIELabMatrix ' default (?)
        End If

        If chkSize.CheckState = Windows.Forms.CheckState.Checked Then
            pMultiRend.SizeRend = m_pSizeRend
        Else
            pMultiRend.SizeRend = Nothing
        End If

        Dim pRotRend As IRotationRenderer
        Dim pFormRotRend As IRotationRenderer
        pRotRend = pMultiRend
        If chkRotation.CheckState = Windows.Forms.CheckState.Checked Then
            pFormRotRend = m_pRend
            pRotRend.RotationField = pFormRotRend.RotationField
            pRotRend.RotationType = pFormRotRend.RotationType
        Else
            pRotRend.RotationField = ""
            pRotRend.RotationType = esriSymbolRotationType.esriRotateSymbolArithmetic ' default (?)
        End If

        'Dim pTransRend As ITransparencyRenderer
        'Dim pFormTransRend As ITransparencyRenderer
        'pTransRend = pMultiRend
        'If chkTransparency.CheckState = Windows.Forms.CheckState.Checked Then
        '    pFormTransRend = m_pRend
        '    pTransRend.TransparencyField = pFormTransRend.TransparencyField
        'Else
        '    pTransRend.TransparencyField = ""
        'End If


    End Sub

    Private Sub PropPageForm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ' intialize form controls from data members

        Dim pGeoLayers As IEnumLayer
        Dim pUID As New UID
        pUID.Value = "{E156D7E5-22AF-11D3-9F99-00C04F6BC78E}"
        pGeoLayers = m_pMap.Layers(pUID, True)
        pGeoLayers.Reset()
        Dim pGeoLayer As IGeoFeatureLayer
        Dim pFeatRend As IFeatureRenderer
        Dim iColor As Integer = 0
        Dim iShapePattern As Integer = 0
        Dim iSize As Integer = 0

        pGeoLayer = pGeoLayers.Next
        Dim sColor1 As String = ""
        Dim sColor2 As String = ""
        Dim sShapePattern As String = ""
        Dim sSize As String = ""

        Do While Not pGeoLayer Is Nothing
            ' to keep things simple, filter for layers with same feat class geometry (point, line, poly) as current layer
            If (pGeoLayer.FeatureClass.ShapeType) = (m_pCurrentLayer.FeatureClass.ShapeType) Then
                ' filter out the current layer
                If (Not pGeoLayer Is m_pCurrentLayer) Then
                    pFeatRend = pGeoLayer.Renderer

                    ' filter for only layers currently assigned a renderer that is valid for each renderer type (shape, color, size)
                    If RendererIsValidForType(pFeatRend, eRendererType.eColor) Then
                        iColor = iColor + 1
                        ReDim Preserve m_pColorRendList(iColor)
                        m_pColorRendList(iColor - 1) = pFeatRend

                        cboHue.Items.Add(pGeoLayer.Name)
                        cboSatValue.Items.Add(pGeoLayer.Name)
                        cboPrimaryColor.Items.Add(pGeoLayer.Name)
                        cboSecondaryColor.Items.Add(pGeoLayer.Name)

                        If CompareRenderers(pGeoLayer.Renderer, m_pColorRend1) Then sColor1 = pGeoLayer.Name
                        If CompareRenderers(pGeoLayer.Renderer, m_pColorRend2) Then sColor2 = pGeoLayer.Name
                    End If

                    If RendererIsValidForType(pFeatRend, eRendererType.eShapePattern) Then
                        iShapePattern = iShapePattern + 1
                        ReDim Preserve m_pShapePatternRendList(iShapePattern)
                        m_pShapePatternRendList(iShapePattern - 1) = pFeatRend

                        cboShapePattern.Items.Add(pGeoLayer.Name)

                        'If pGeoLayer.Renderer Is m_pShapePatternRend Then sShapePattern = pGeoLayer.Name
                        If CompareRenderers(pGeoLayer.Renderer, m_pShapePatternRend) Then sShapePattern = pGeoLayer.Name
                    End If

                    If RendererIsValidForType(pFeatRend, eRendererType.eSize) Then
                        iSize = iSize + 1
                        ReDim Preserve m_pSizeRendList(iSize)
                        m_pSizeRendList(iSize - 1) = pFeatRend

                        cboSize1.Items.Add(pGeoLayer.Name)

                        'If pGeoLayer.Renderer Is m_pSizeRend Then sSize = pGeoLayer.Name
                        If CompareRenderers(pGeoLayer.Renderer, m_pSizeRend) Then sSize = pGeoLayer.Name
                    End If

                End If
            End If
            pGeoLayer = pGeoLayers.Next
        Loop

        ' select correct items in combos
        cboShapePattern().Text = sShapePattern
        If radComponents.Checked Then
            cboHue.Text() = sColor1
            cboSatValue.Text() = sColor2
        Else
            cboPrimaryColor.Text() = sColor1
            cboSecondaryColor.Text() = sColor2
        End If
        'TESTING:

        cboSize1.Text() = sSize
        'TESTING:
        cboShapePattern.Text() = sShapePattern
        ' disable if there aren't any layers in the map of the correct type
        If iShapePattern <= 0 Then cboShapePattern.Enabled = False

        If iColor <= 0 Then
            If radComponents.Checked Then
                cboHue.Enabled = False
                cboSatValue.Enabled = False
            Else
                cboPrimaryColor.Enabled = False
                cboSecondaryColor.Enabled = False
            End If
        End If

        If iSize <= 0 Then cboSize1.Enabled = False
    End Sub

    Private Sub cboShapePattern_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboShapePattern.SelectedIndexChanged
        m_pShapePatternRend = m_pShapePatternRendList(cboShapePattern.SelectedIndex)
        If Not m_pSite Is Nothing Then m_pSite.PageChanged()
        m_PageIsDirty = True
    End Sub

    Private Sub cboHue_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboHue.SelectedIndexChanged
        m_pColorRend1 = m_pColorRendList(cboHue.SelectedIndex)
        If Not m_pSite Is Nothing Then m_pSite.PageChanged()
        m_PageIsDirty = True
    End Sub

    Private Sub cboSatValue_selectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboSatValue.SelectedIndexChanged
        m_pColorRend2 = m_pColorRendList(cboSatValue.SelectedIndex)
        If Not m_pSite Is Nothing Then m_pSite.PageChanged()
        m_PageIsDirty = True
    End Sub

    Private Sub cboPrimaryColor_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboPrimaryColor.SelectedIndexChanged
        m_pColorRend1 = m_pColorRendList(cboPrimaryColor.SelectedIndex)
        If Not m_pSite Is Nothing Then m_pSite.PageChanged()
        m_PageIsDirty = True
    End Sub

    Private Sub cboSecondaryColor_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboSecondaryColor.SelectedIndexChanged
        m_pColorRend2 = m_pColorRendList(cboSecondaryColor.SelectedIndex)
        If Not m_pSite Is Nothing Then m_pSite.PageChanged()
        m_PageIsDirty = True
    End Sub

    Private Sub cboSize1_selectedindexchanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboSize1.SelectedIndexChanged
        m_pSizeRend = m_pSizeRendList(cboSize1.SelectedIndex)
        If Not m_pSite Is Nothing Then m_pSite.PageChanged()
        m_PageIsDirty = True
    End Sub

    Private Sub radComponents_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles radComponents.CheckedChanged
        UpdateColorComb()
    End Sub

    Private Sub radCombination_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles radCombination.CheckedChanged
        UpdateColorComb()
    End Sub

    Private Sub UpdateColorComb()

        If radComponents.Checked Then
            m_eColorCombinationMethod = EColorCombinationType.enuComponents

            cboHue.Enabled = True
            cboSatValue.Enabled = True
            cboPrimaryColor.Enabled = False
            cboSecondaryColor.Enabled = False
        Else
            m_eColorCombinationMethod = EColorCombinationType.enuCIELabMatrix

            cboHue.Enabled = False
            cboSatValue.Enabled = False
            cboPrimaryColor.Enabled = True
            cboSecondaryColor.Enabled = True
        End If

        If Not m_pSite Is Nothing Then m_pSite.PageChanged()
        m_PageIsDirty = True

    End Sub

    Private Function RendererIsValidForType(ByVal pFeatRend As IFeatureRenderer, ByVal eMultiRendType As eRendererType) As Boolean
        ' indicates whether or not pFeatRend is valid for the eMultiRendType for the current layer
        ' e.g. if pFeatRend is an IProportionalSymbolRenderer, then it's valid for eMultiRendType = eSize 

        Dim pLegendInfo As ILegendInfo

        If eMultiRendType = eRendererType.eShapePattern Then
            Return TypeOf pFeatRend Is IUniqueValueRenderer
        ElseIf eMultiRendType = eRendererType.eColor Then
            pLegendInfo = pFeatRend
            Return (TypeOf pFeatRend Is IUniqueValueRenderer) Or (TypeOf pFeatRend Is IClassBreaksRenderer And Not pLegendInfo.SymbolsAreGraduated)
        Else ' size
            pLegendInfo = pFeatRend
            Return (TypeOf pFeatRend Is IClassBreaksRenderer And pLegendInfo.SymbolsAreGraduated) Or (TypeOf pFeatRend Is IProportionalSymbolRenderer)
        End If

    End Function

    Private Sub butRotation_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butRotation.Click
        Dim pRendUIDlg2 As IRendererUIDialog2
        pRendUIDlg2 = New MarkerRotationDialog
        pRendUIDlg2.FeatureLayer = m_pCurrentLayer
        pRendUIDlg2.Renderer = m_pRend
        Dim pMyForm As SecondaryForm
        pMyForm = New SecondaryForm
        pRendUIDlg2.DoModal(pMyForm.Handle.ToInt32)

    End Sub

    Private Sub chkShapePattern_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkShapePattern.CheckedChanged
        cboShapePattern.Enabled = (chkShapePattern.CheckState = Windows.Forms.CheckState.Checked)
        If Not m_pSite Is Nothing Then m_pSite.PageChanged()
        m_PageIsDirty = True
    End Sub

    Private Sub chkColor_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkColor.CheckedChanged
        'combination is disabled
        'radComponents.Enabled = (chkColor.CheckState = Windows.Forms.CheckState.Checked)
        'radCombination.Enabled = (chkColor.CheckState = Windows.Forms.CheckState.Checked)
        radComponents.Enabled = (chkColor.CheckState = Windows.Forms.CheckState.Checked)
        radCombination.Enabled = False
        If Not m_pSite Is Nothing Then m_pSite.PageChanged()
        m_PageIsDirty = True
    End Sub

    Private Sub chkSize_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkSize.CheckedChanged
        cboSize1.Enabled = (chkSize.CheckState = Windows.Forms.CheckState.Checked)
        If Not m_pSite Is Nothing Then m_pSite.PageChanged()
        m_PageIsDirty = True
    End Sub


    Private Sub chkRotation_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkRotation.CheckedChanged
        butRotation.Enabled = (chkRotation.CheckState = Windows.Forms.CheckState.Checked)
        If Not m_pSite Is Nothing Then m_pSite.PageChanged()
        m_PageIsDirty = True
    End Sub

    'Private Sub chkTransparency_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
    '   butTransparency.Enabled = (chkTransparency.CheckState = Windows.Forms.CheckState.Checked)
    '  If Not m_pSite Is Nothing Then m_pSite.PageChanged()
    ' m_PageIsDirty = True
    'End Sub

    Private Sub radComponents_EnabledChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles radComponents.EnabledChanged

        cboHue.Enabled = radComponents.Enabled And radComponents.Checked
        cboSatValue.Enabled = radComponents.Enabled And radComponents.Checked
    End Sub

    Private Sub radCombination_EnabledChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles radCombination.EnabledChanged
        'disabled
        'cboPrimaryColor.Enabled = radCombination.Enabled And radCombination.Checked
        'cboSecondaryColor.Enabled = radCombination.Enabled And radCombination.Checked
        cboPrimaryColor.Enabled = False
        cboSecondaryColor.Enabled = False
    End Sub

    Private Sub cboHue_EnabledChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cboHue.EnabledChanged

        lblHue.Enabled = cboHue.Enabled
    End Sub

    Private Sub cboSatValue_EnabledChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cboSatValue.EnabledChanged

        lblSatValue.Enabled = cboSatValue.Enabled
    End Sub

    Private Sub cboPrimaryColor_EnabledChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cboPrimaryColor.EnabledChanged

        lblPrimaryColor.Enabled = cboPrimaryColor.Enabled
    End Sub

    Private Sub cboSecondaryColor_EnabledChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cboSecondaryColor.EnabledChanged

        lblSecondaryColor.Enabled = cboSecondaryColor.Enabled
    End Sub

    Private Function CompareRenderers(ByVal pRend As IFeatureRenderer, ByVal pCheckRend As IFeatureRenderer) As Boolean

        If TypeOf pRend Is IClassBreaksRenderer Then
            ' type
            If Not TypeOf pCheckRend Is IClassBreaksRenderer Then Return False

            Dim pCBRend As IClassBreaksRenderer
            pCBRend = pRend
            Dim pCBCheckRend As IClassBreaksRenderer
            pCBCheckRend = pCheckRend

            ' break count
            If pCBRend.BreakCount <> pCBCheckRend.BreakCount Then Return False

            ' field
            If pCBRend.Field <> pCBCheckRend.Field Then Return False

        End If

        Return True

    End Function
End Class