/// <summary> /// 加标题 /// </summary> public void AddNewTitle() { LayoutClass.TextboxSymbol from = new LayoutClass.TextboxSymbol(new Point(30, 40), new Font("宋体", 30), Color.Black, "请输入标题"); //?? Point location = ComputeResizeLocation(from.textbox.Location, boxscale); TextboxSymbol text = new TextboxSymbol(from, location, boxscale); this.Add(text.textbox); }
/// <summary> /// 加文本 /// </summary> public void AddText() { LayoutClass.TextboxSymbol from = new LayoutClass.TextboxSymbol(new Point(100, 100), "文本"); //?? Point location = ComputeResizeLocation(from.textbox.Location, boxscale); TextboxSymbol text = new TextboxSymbol(from, location, boxscale); this.Add(text.textbox); }
/// <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(); } } }