private List<string> ExportSymbol(IStyleGallery sg,string symbolType, int col, int row, int size,int width, int labelsize, int label_h, int size_w, int size_h, double height, string cat, IPageLayout3 layout) { List<string> pdfpages = new List<string>(); IGraphicsContainer con = layout as IGraphicsContainer; IPage page = layout.Page; int r = 0; int c = 0; int p = 0; IEnumStyleGalleryItem items = sg.get_Items(symbolType, "", cat); IStyleGalleryItem item = items.Next(); while (item != null) { #region Symbol if (symbolType == "Marker Symbols") { IMarkerElement mele = new MarkerElementClass(); IPoint ptn = new PointClass(); ptn.PutCoords(c * size_w + size / 2, height - (r * size_h + size / 2)); IElement ele_i = mele as IElement; ele_i.Geometry = ptn; IMarkerSymbol sym_m = item.Item as IMarkerSymbol; sym_m.Size = size; mele.Symbol = sym_m; con.AddElement(ele_i, 0); } else if (symbolType == "Line Symbols") { ILineElement lele = new LineElementClass(); IPolyline line = new PolylineClass(); IPoint ptn_f = new PointClass(); ptn_f.PutCoords(c * size_w + size / 4, height - (r * size_h + size * 3 / 4)); IPoint ptn_t = new PointClass(); ptn_t.PutCoords(c * size_w + size * 3 / 4, height - (r * size_h + size / 4)); line.FromPoint = ptn_f; line.ToPoint = ptn_t; IElement ele_i = lele as IElement; ele_i.Geometry = line; ILineSymbol sym_l = item.Item as ILineSymbol; sym_l.Width = width; lele.Symbol = sym_l; con.AddElement(ele_i, 0); } else if (symbolType == "Fill Symbols") { IRectangleElement fele = new RectangleElementClass(); IFillShapeElement fsele = fele as IFillShapeElement; IEnvelope env_f = new EnvelopeClass(); env_f.PutCoords(c * size_w + size / 4, height - (r * size_h + size * 3 / 4), c * size_w + size * 3 / 4, height - (r * size_h + size / 4)); IElement ele_i = fele as IElement; ele_i.Geometry = env_f; IFillSymbol sym_f = item.Item as IFillSymbol; fsele.Symbol = sym_f; con.AddElement(ele_i, 0); } #endregion if (cbGrid.Checked) { #region Grid IEnvelope env_g = new EnvelopeClass(); env_g.PutCoords(c * size_w, height - r * size_h, c * size_w + size_w, height - r * size_h - size_h); IRectangleElement gele = new RectangleElementClass(); IElement ele_g = gele as IElement; ele_g.Geometry = env_g; IFillSymbol sym_g = new SimpleFillSymbolClass(); IRgbColor color_g = new RgbColorClass(); color_g.NullColor = true; sym_g.Color = color_g; IFillShapeElement fshp_g = ele_g as IFillShapeElement; fshp_g.Symbol = sym_g; con.AddElement(ele_g, 0); #endregion } #region Label ITextElement tele = new ParagraphTextElementClass(); IElement ele_t = tele as IElement; tele.Text = item.Name; IEnvelope env_l = new EnvelopeClass(); env_l.PutCoords(c * size_w, height - r * size_h - size_h + label_h, c * size_w + size_w, height - r * size_h - size_h); env_l.PutCoords(c * size_w, height - r * size_h - size_h + label_h, c * size_w + size_w, height - r * size_h - size_h); env_l.PutCoords(c * size_w, height - r * size_h - size_h + label_h, c * size_w + size_w, height - r * size_h - size_h); env_l.PutCoords(c * size_w, height - r * size_h - size_h + label_h, c * size_w + size_w, height - r * size_h - size_h); env_l.PutCoords(c * size_w, height - r * size_h - size_h + label_h, c * size_w + size_w, height - r * size_h - size_h); ele_t.Geometry = env_l; ITextSymbol sym_label = new TextSymbolClass(); sym_label.Size = labelsize/2; IRgbColor color = new RgbColorClass(); color.NullColor = true; ISimpleLineSymbol sym_border = new SimpleLineSymbolClass(); sym_border.Color = color; ISymbolBorder border = new SymbolBorderClass(); border.LineSymbol = sym_border; IFrameProperties fp = ele_t as IFrameProperties; fp.Border = border; con.AddElement(ele_t, 0); #endregion if (c < col - 1) { c++; } else { c = 0; if (r < row - 1) { r++; } else { IActiveView av = layout as IActiveView; string temp_pdf = System.IO.Path.GetTempFileName() + ".pdf"; ExportPDF(av, temp_pdf); pdfpages.Add(temp_pdf); con.DeleteAllElements(); r = 0; c = 0; p++; } } item = items.Next(); } if (con.Next() != null) { IActiveView av = layout as IActiveView; string temp_pdf = System.IO.Path.GetTempFileName() + ".pdf"; ExportPDF(av, temp_pdf); pdfpages.Add(temp_pdf); con.DeleteAllElements(); } return pdfpages; }