AreaLinePatches.Form2.GetItem C# (CSharp) Method

GetItem() public method

public GetItem ( ESRI styleClass ) : IStyleGalleryItem
styleClass ESRI
return IStyleGalleryItem
		public IStyleGalleryItem GetItem(ESRI.ArcGIS.Controls.esriSymbologyStyleClass styleClass)
		{
			//Retrieve the selected area/line patch style from the SymbologyControl
			m_styleGalleryItem = null;
			//disable ok button
			button1.Enabled = false; 
      
			//Set the style class of SymbologyControl1
			axSymbologyControl1.StyleClass = styleClass; 
			//Unselect any selected item in the current style class
			axSymbologyControl1.GetStyleClass(styleClass).UnselectItem(); 
      
			//Show the modal form
			this.ShowDialog();

			//return the label style that has been selected from the SymbologyControl
			return m_styleGalleryItem;
		}

Usage Example

        private void button4_Click(object sender, System.EventArgs e)
        {
            //create the form with the SymbologyControl
            Form2 symbolForm = new Form2();

            //Get the IStyleGalleryItem that has been selected in the SymbologyControl
            IStyleGalleryItem styleGalleryItem = symbolForm.GetItem(esriSymbologyStyleClass.esriStyleClassLinePatches);

            //release the form
            symbolForm.Dispose();
            if (styleGalleryItem == null)
            {
                return;
            }

            //Find the legend
            IElement element = axPageLayoutControl1.FindElementByName("Legend", 1);

            if (element == null)
            {
                return;
            }

            //Get the IMapSurroundFrame
            IMapSurroundFrame mapSurroundFrame = (IMapSurroundFrame)element;

            if (mapSurroundFrame == null)
            {
                return;
            }

            //If a legend exists change the default area patch
            ILegend legend = (ILegend)mapSurroundFrame.MapSurround;

            legend.Format.DefaultLinePatch = (ILinePatch)styleGalleryItem.Item;

            //Update the legend
            legend.Refresh();
            //Refresh the display
            axPageLayoutControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
        }
All Usage Examples Of AreaLinePatches.Form2::GetItem