private void PreviewImage() { //Get and set the style class ISymbologyStyleClass symbologyStyleClass = axSymbologyControl1.GetStyleClass(axSymbologyControl1.StyleClass); //Preview an image of the symbol stdole.IPictureDisp picture = symbologyStyleClass.PreviewItem(m_styleGalleryItem, pictureBox1.Width, pictureBox1.Height); System.Drawing.Image image = System.Drawing.Image.FromHbitmap(new System.IntPtr(picture.Handle)); pictureBox1.Image = image; }
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); }
private void LoadStyles() { //Get the ArcGIS install location string sInstall = ESRI.ArcGIS.RuntimeManager.ActiveRuntime.Path; string defaultStyle = System.IO.Path.Combine(sInstall, "Styles\\ESRI.ServerStyle"); if (System.IO.File.Exists(defaultStyle)) { //Load the ESRI.ServerStyle file into the SymbologyControl axSymbologyControl1.LoadStyleFile(defaultStyle); axSymbologyControl1.StyleClass = styleClass; axSymbologyControl1.GetStyleClass(axSymbologyControl1.StyleClass).SelectItem(0); cbxStyles.Text = defaultStyle; } stylesPath = sInstall + "\\Styles"; cbxStyles.Items.Clear(); cbxStylesAddItems(stylesPath); }
private void Form1_Load(object sender, System.EventArgs e) { //Set the buddy control axToolbarControl1.SetBuddyControl(axPageLayoutControl1); //Add items to the ToolbarControl axToolbarControl1.AddItem("esriControls.ControlsOpenDocCommand", -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconAndText); axToolbarControl1.AddItem("esriControls.ControlsSaveAsDocCommand", -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconAndText); axToolbarControl1.AddItem("esriControls.ControlsPageZoomInTool", -1, -1, true, 0, esriCommandStyles.esriCommandStyleIconAndText); axToolbarControl1.AddItem("esriControls.ControlsPageZoomOutTool", -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconAndText); axToolbarControl1.AddItem("esriControls.ControlsPageZoomWholePageCommand", -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconAndText); //Get the ArcGIS install location by opening the subkey for reading string sInstallPath = ESRI.ArcGIS.RuntimeManager.ActiveRuntime.Path; //Load the ESRI.ServerStyle file into the SymbologyControl axSymbologyControl1.LoadStyleFile(sInstallPath + "\\Styles\\ESRI.ServerStyle"); //Add style classes to the combo box ComboBox1.Items.Add("Backgrounds"); ComboBox1.Items.Add("Borders"); ComboBox1.Items.Add("Shadows"); ComboBox1.SelectedIndex = 0; //Update each style class. This forces item to be loaded into each style class. //When the contents of a server style file are loaded into the SymbologyControl //items are 'demand loaded'. This is done to increase performance and means //items are only loaded into a SymbologyStyleClass when it is the current StyleClass. axSymbologyControl1.GetStyleClass(esriSymbologyStyleClass.esriStyleClassBackgrounds).Update(); axSymbologyControl1.GetStyleClass(esriSymbologyStyleClass.esriStyleClassBorders).Update(); axSymbologyControl1.GetStyleClass(esriSymbologyStyleClass.esriStyleClassShadows).Update(); }
private void Form3_Load(object sender, System.EventArgs e) { //Get the ArcGIS install location string sInstall = ESRI.ArcGIS.RuntimeManager.ActiveRuntime.Path; //Load the ESRI.ServerStyle file into the SymbologyControl axSymbologyControl1.LoadStyleFile(sInstall + "\\Styles\\ESRI.ServerStyle"); //Set the style class axSymbologyControl1.StyleClass = esriSymbologyStyleClass.esriStyleClassColorRamps; //Select the color ramp item axSymbologyControl1.GetStyleClass(axSymbologyControl1.StyleClass).SelectItem(0); }
private void axSymbologyControl4_OnDoubleClick(object sender, ESRI.ArcGIS.Controls.ISymbologyControlEvents_OnDoubleClickEvent e) { //Update symbols with selected symbol UpdateSymbol(axSymbologyControl4.GetStyleClass(axSymbologyControl4.StyleClass).GetSelectedItem()); }
private void Form1_Load(object sender, System.EventArgs e) { //Resize the controls so that they scale correctly at both 96 and 120 dpi AdjustBounds(this.axToolbarControl1); AdjustBounds(this.axLicenseControl1); AdjustBounds(this.axPageLayoutControl1); AdjustBounds(this.axSymbologyControl1); //Set the buddy control axToolbarControl1.SetBuddyControl(axPageLayoutControl1); //Add items to the ToolbarControl axToolbarControl1.AddItem("esriControls.ControlsOpenDocCommand", -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl1.AddItem("esriControls.ControlsPageZoomInTool", -1, -1, true, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl1.AddItem("esriControls.ControlsPageZoomOutTool", -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl1.AddItem("esriControls.ControlsPageZoomWholePageCommand", -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl1.AddItem("esriControls.ControlsSelectTool", -1, -1, true, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl1.AddItem("esriControls.ControlsNewMarkerTool", -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl1.AddItem("esriControls.ControlsNewLineTool", -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl1.AddItem("esriControls.ControlsNewFreeHandTool", -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl1.AddItem("esriControls.ControlsNewRectangleTool", -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl1.AddItem("esriControls.ControlsNewPolygonTool", -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); //Get the ArcGIS install location by opening the subkey for reading //Load the ESRI.ServerStyle file into the SymbologyControl string installationFolder = ESRI.ArcGIS.RuntimeManager.ActiveRuntime.Path; axSymbologyControl1.LoadStyleFile(installationFolder + "\\Styles\\ESRI.ServerStyle"); //Add style classes to the combo box ComboBox1.Items.Add("Default Marker Symbol"); ComboBox1.Items.Add("Default Line Symbol"); ComboBox1.Items.Add("Default Fill Symbol"); ComboBox1.Items.Add("Default Text Symbol"); ComboBox1.SelectedIndex = 0; //Update each style class. This forces item to be loaded into each style class. //When the contents of a server style file are loaded into the SymbologyControl //items are 'demand loaded'. This is done to increase performance and means //items are only loaded into a SymbologyStyleClass when it is the current StyleClass. axSymbologyControl1.GetStyleClass(esriSymbologyStyleClass.esriStyleClassMarkerSymbols).Update(); axSymbologyControl1.GetStyleClass(esriSymbologyStyleClass.esriStyleClassLineSymbols).Update(); axSymbologyControl1.GetStyleClass(esriSymbologyStyleClass.esriStyleClassFillSymbols).Update(); axSymbologyControl1.GetStyleClass(esriSymbologyStyleClass.esriStyleClassTextSymbols).Update(); //Get the CommandsEnvironment singleton m_graphicProperties = new CommandsEnvironmentClass(); //Create a new ServerStyleGalleryItem and set its name IStyleGalleryItem styleGalleryItem = new ServerStyleGalleryItemClass(); styleGalleryItem.Name = "myStyle"; ISymbologyStyleClass styleClass; //Get the marker symbol style class styleClass = axSymbologyControl1.GetStyleClass(esriSymbologyStyleClass.esriStyleClassMarkerSymbols); //Set the commands environment marker symbol into the item styleGalleryItem.Item = m_graphicProperties.MarkerSymbol; //Add the item to the style class styleClass.AddItem(styleGalleryItem, 0); //Get the line symbol style class styleClass = axSymbologyControl1.GetStyleClass(esriSymbologyStyleClass.esriStyleClassLineSymbols); //Set the commands environment line symbol into the item styleGalleryItem.Item = m_graphicProperties.LineSymbol; //Add the item to the style class styleClass.AddItem(styleGalleryItem, 0); //Get the fill symbol style class styleClass = axSymbologyControl1.GetStyleClass(esriSymbologyStyleClass.esriStyleClassFillSymbols); //Set the commands environment fill symbol into the item styleGalleryItem.Item = m_graphicProperties.FillSymbol; //Add the item to the style class styleClass.AddItem(styleGalleryItem, 0); //Get the text symbol style class styleClass = axSymbologyControl1.GetStyleClass(esriSymbologyStyleClass.esriStyleClassTextSymbols); //Set the commands environment text symbol into the item styleGalleryItem.Item = m_graphicProperties.TextSymbol; //Add the item to the style class styleClass.AddItem(styleGalleryItem, 0); }