예제 #1
0
        /// <summary>
        ///加指北针
        /// </summary>
        public void AddNewCompass()
        {
            LayoutClass.CompassSymbol from = new LayoutClass.CompassSymbol();
            Point         location         = ComputeResizeLocation(from.Box.Location, boxscale);
            CompassSymbol newcompass       = new CompassSymbol(from, location, boxscale);

            this.Add(newcompass.Box);
        }
예제 #2
0
        /// <summary>
        /// 放大缩小事件重绘事件TODO
        /// </summary>
        private void ResizeAllControl()
        {
            double resizescale;

            if (PB_background.Width < PB_background.Height)
            {
                resizescale = (double)((size_boxregular.Width * boxscale) / PB_background.Size.Width);
            }
            else
            {
                resizescale = (double)((size_boxregular.Height * boxscale) / PB_background.Size.Width);
            }
            PB_background.Size     = new Size((int)(PB_background.Width * resizescale), (int)(PB_background.Height * resizescale));
            PB_background.Location = new Point((this.Width - PB_background.Width) / 2, (this.Height - PB_background.Height) / 2);

            foreach (Control c in this.PB_background.Controls)
            {
                if (c.Name == "Map")
                {
                    c.Location = ComputeResizeLocation(c.Location, resizescale);
                    Bitmap newmap = new Bitmap(mapbitmap, new Size((int)(mapbitmap.Width * boxscale / ratio2screen), (int)(mapbitmap.Height * boxscale / ratio2screen)));
                    c.Size = newmap.Size;
                    ((PictureBox)c).Image = newmap;
                }
                if (c.Name == "TextboxSymbol")
                {
                    TextboxSymbol from = new TextboxSymbol();
                    from.textbox = (Label)c;
                    Point         newlocation   = ComputeResizeLocation(c.Location, resizescale);
                    TextboxSymbol newtextsymbol = new TextboxSymbol(from, newlocation, resizescale);
                    PB_background.Controls.Remove(c);
                    this.Add(newtextsymbol.textbox);
                }

                if (c.Name == "ScaleSymbol")
                {
                    ScaleSymbol from = new ScaleSymbol(real2map, new Point((int)(PB_background.Width * 0.7), (int)(PB_background.Height * 0.7)));
                    from.Box = (PictureBox)c;
                    Point       newlocation = ComputeResizeLocation(c.Location, resizescale);
                    ScaleSymbol newsymbol   = new ScaleSymbol(from, real2map, newlocation, resizescale);
                    PB_background.Controls.Remove(c);
                    this.Add(newsymbol.Box);
                }
                if (c.Name == "CompassSymbol")
                {
                    CompassSymbol from = new CompassSymbol();
                    from.Box = (Label)c;
                    Point         newlocation = ComputeResizeLocation(c.Location, resizescale);
                    CompassSymbol newsymbol   = new CompassSymbol(from, newlocation, resizescale);
                    PB_background.Controls.Remove(c);
                    this.Add(newsymbol.Box);
                }
                if (c.Name == "LegendSymbol")
                {
                    LegendSymbol from = new LegendSymbol(thismap, new Point((int)(PB_background.Width * 0.7), (int)(PB_background.Height * 0.5)));
                    from.Box = (Label)c;
                    Point        newlocation = ComputeResizeLocation(c.Location, resizescale);
                    LegendSymbol newsymbol   = new LegendSymbol(thismap, from, newlocation, boxscale);
                    PB_background.Controls.Remove(c);
                    this.Add(newsymbol.Box);
                }
                if (c.Name == "NeatLine")
                {
                    SetNeatline();
                }
            }
        }