Example #1
0
        //添加GLISTBOX项
        private void addListBoxItem(ISymbol symbol)
        {
            IStyleGallery        styleGallery;
            IStyleGalleryItem    styleGalleryItem;
            IStyleGalleryStorage styleGalleryStorge;

            styleGalleryItem          = new ServerStyleGalleryItemClass();
            styleGalleryItem.Name     = this.txtSymbolName.Text;
            styleGalleryItem.Category = "default";
            object objSymbol = symbol;

            styleGalleryItem.Item = objSymbol;

            styleGallery                  = new ServerStyleGalleryClass();
            styleGalleryStorge            = styleGallery as IStyleGalleryStorage;
            styleGalleryStorge.TargetFile = fileName;

            //IStyleGalleryClass styleGalleryClass = styleGallery.get_Class(CurrentStyleGalleryClassIndex);
            ISymbologyStyleClass pSymbolClass = psymbologyStyleClass;

            pSymbolClass.AddItem(styleGalleryItem, 0);
            pSymbolClass.SelectItem(0);

            stdole.IPictureDisp pPicture = pSymbolClass.PreviewItem(styleGalleryItem, 140, 20);
            Image     image = Image.FromHbitmap(new System.IntPtr(pPicture.Handle));
            GridPanel panel = supergrid.PrimaryGrid;
            GridRow   row   = new GridRow(image);

            panel.Rows.Add(row);
            psymbologyStyleClass.RemoveItem(0);
            imagelist.Add(image);
        }
Example #2
0
        //添加GLISTBOX项
        private void addListBoxItem(ISymbol symbol)
        {
            IStyleGallery        styleGallery;
            IStyleGalleryItem    styleGalleryItem;
            IStyleGalleryStorage styleGalleryStorge;

            styleGalleryItem          = new ServerStyleGalleryItemClass();
            styleGalleryItem.Name     = this.txtSymbolName.Text;
            styleGalleryItem.Category = "default";
            object objSymbol = symbol;

            styleGalleryItem.Item = objSymbol;

            styleGallery                  = new ServerStyleGalleryClass();
            styleGalleryStorge            = styleGallery as IStyleGalleryStorage;
            styleGalleryStorge.TargetFile = fileName;

            ISymbologyStyleClass pSymbolClass = psymbologyStyleClass;

            pSymbolClass.AddItem(styleGalleryItem, 0);
            pSymbolClass.SelectItem(0);
            Image image = null;

            if (symbol is IMarker3DSymbol)
            {
                IMarker3DSymbol mar3dsym = symbol as IMarker3DSymbol;
                stdole.IPicture pic      = mar3dsym.Thumbnail;
                image = Image.FromHbitmap(new System.IntPtr(pic.Handle));
            }
            else
            {
                stdole.IPictureDisp pPicture = pSymbolClass.PreviewItem(styleGalleryItem, 140, 15);
                image = Image.FromHbitmap(new System.IntPtr(pPicture.Handle));
            }

            GridPanel panel = supergrid.PrimaryGrid;
            GridRow   row   = new GridRow(image);

            panel.Rows.Add(row);
            psymbologyStyleClass.RemoveItem(0);
            imagelist.Add(image);
            Symbollist.Add(symbol);
        }