Inheritance: System.Windows.Forms.Form
        private void axTOCControl1_OnMouseDown(object sender, ESRI.ArcGIS.Controls.ITOCControlEvents_OnMouseDownEvent e)
        {
            //Exit if not right mouse button
            if (e.button != 2)
            {
                return;
            }

            IBasicMap          map   = new MapClass();
            ILayer             layer = new FeatureLayerClass();
            object             other = new Object();
            object             index = new Object();
            esriTOCControlItem item  = new esriTOCControlItem();

            //Determine what kind of item has been clicked on
            axTOCControl1.HitTest(e.x, e.y, ref item, ref map, ref layer, ref other, ref index);

            //QI to IFeatureLayer and IGeoFeatuerLayer interface
            if (layer == null)
            {
                return;
            }
            IFeatureLayer featureLayer = layer as IFeatureLayer;

            if (featureLayer == null)
            {
                return;
            }
            IGeoFeatureLayer geoFeatureLayer = (IGeoFeatureLayer)featureLayer;
            ISimpleRenderer  simpleRenderer  = (ISimpleRenderer)geoFeatureLayer.Renderer;

            //Create the form with the SymbologyControl
            frmSymbol symbolForm = new frmSymbol();

            //Get the IStyleGalleryItem
            IStyleGalleryItem styleGalleryItem = null;

            //Select SymbologyStyleClass based upon feature type
            switch (featureLayer.FeatureClass.ShapeType)
            {
            case esriGeometryType.esriGeometryPoint:
                styleGalleryItem = symbolForm.GetItem(esriSymbologyStyleClass.esriStyleClassMarkerSymbols, simpleRenderer.Symbol);
                break;

            case esriGeometryType.esriGeometryPolyline:
                styleGalleryItem = symbolForm.GetItem(esriSymbologyStyleClass.esriStyleClassLineSymbols, simpleRenderer.Symbol);
                break;

            case esriGeometryType.esriGeometryPolygon:
                styleGalleryItem = symbolForm.GetItem(esriSymbologyStyleClass.esriStyleClassFillSymbols, simpleRenderer.Symbol);
                break;
            }

            //Release the form
            symbolForm.Dispose();
            this.Activate();

            if (styleGalleryItem == null)
            {
                return;
            }

            //Create a new renderer
            simpleRenderer = new SimpleRendererClass();
            //Set its symbol from the styleGalleryItem
            simpleRenderer.Symbol = (ISymbol)styleGalleryItem.Item;
            //Set the renderer into the geoFeatureLayer
            geoFeatureLayer.Renderer = (IFeatureRenderer)simpleRenderer;

            //Fire contents changed event that the TOCControl listens to
            axPageLayoutControl1.ActiveView.ContentsChanged();
            //Refresh the display
            axPageLayoutControl1.Refresh(esriViewDrawPhase.esriViewGeography, null, null);
        }
		private void axTOCControl1_OnMouseDown(object sender, ESRI.ArcGIS.Controls.ITOCControlEvents_OnMouseDownEvent e)
		{
			//Exit if not right mouse button
			if (e.button != 2) return;

			IBasicMap map = new MapClass();
			ILayer layer = new FeatureLayerClass();
			object other = new Object();
			object index = new Object();
			esriTOCControlItem item = new esriTOCControlItem(); 

			//Determine what kind of item has been clicked on
			axTOCControl1.HitTest(e.x, e.y, ref item, ref map, ref layer, ref other, ref index);

			//QI to IFeatureLayer and IGeoFeatuerLayer interface
			if (layer == null) return;
			IFeatureLayer featureLayer = layer as IFeatureLayer;
			if (featureLayer == null) return;
			IGeoFeatureLayer geoFeatureLayer = (IGeoFeatureLayer) featureLayer;
			ISimpleRenderer simpleRenderer = (ISimpleRenderer) geoFeatureLayer.Renderer;

			//Create the form with the SymbologyControl
			frmSymbol symbolForm = new frmSymbol();

			//Get the IStyleGalleryItem
			IStyleGalleryItem styleGalleryItem = null;
			//Select SymbologyStyleClass based upon feature type
			switch (featureLayer.FeatureClass.ShapeType)
			{
				case esriGeometryType.esriGeometryPoint:
					styleGalleryItem = symbolForm.GetItem(esriSymbologyStyleClass.esriStyleClassMarkerSymbols, simpleRenderer.Symbol);
					break;
				case esriGeometryType.esriGeometryPolyline:
					styleGalleryItem = symbolForm.GetItem(esriSymbologyStyleClass.esriStyleClassLineSymbols, simpleRenderer.Symbol);
					break;
				case esriGeometryType.esriGeometryPolygon:
					styleGalleryItem = symbolForm.GetItem(esriSymbologyStyleClass.esriStyleClassFillSymbols, simpleRenderer.Symbol);
					break;
			}

			//Release the form
			symbolForm.Dispose();
			this.Activate();

			if (styleGalleryItem == null) return; 

			//Create a new renderer
			simpleRenderer = new SimpleRendererClass();
			//Set its symbol from the styleGalleryItem
			simpleRenderer.Symbol = (ISymbol) styleGalleryItem.Item;
			//Set the renderer into the geoFeatureLayer
			geoFeatureLayer.Renderer = (IFeatureRenderer) simpleRenderer;

			//Fire contents changed event that the TOCControl listens to
			axPageLayoutControl1.ActiveView.ContentsChanged();
			//Refresh the display
			axPageLayoutControl1.Refresh(esriViewDrawPhase.esriViewGeography, null, null);

		}