/// <summary> /// Update control size /// </summary> public void UpdateControlSize() { if (_graphic.Shape == null) { return; } _updatingSize = true; switch (_graphic.Shape.ShapeType) { case ShapeTypes.Point: PointShape aPS = (PointShape)_graphic.Shape; this.Left = (int)aPS.Point.X; this.Top = (int)aPS.Point.Y; if (_graphic.Legend.GetType() == typeof(PointBreak)) { PointBreak aPB = (PointBreak)_graphic.Legend; this.Left -= (int)(aPB.Size / 2); this.Top -= (int)(aPB.Size / 2); this.Width = (int)Math.Ceiling(aPB.Size); this.Height = (int)Math.Ceiling(aPB.Size); } else if (_graphic.Legend.GetType() == typeof(LabelBreak)) { LabelBreak aLB = (LabelBreak)_graphic.Legend; SizeF aSF = _mapLayout.CreateGraphics().MeasureString(aLB.Text, aLB.Font); this.Left -= (int)(aSF.Width / 2); this.Top -= (int)(aSF.Height / 2); this.Width = (int)Math.Ceiling(aSF.Width); this.Height = (int)Math.Ceiling(aSF.Height); } break; case ShapeTypes.WindArraw: WindArraw aWA = (WindArraw)_graphic.Shape; this.Left = (int)aWA.Point.X; this.Top = (int)aWA.Point.Y; this.Width = (int)(aWA.length * ((VectorBreak)_graphic.Legend).Zoom); this.Height = 20; break; case ShapeTypes.Polyline: case ShapeTypes.Polygon: case ShapeTypes.Rectangle: case ShapeTypes.Circle: case ShapeTypes.CurveLine: case ShapeTypes.CurvePolygon: case ShapeTypes.Ellipse: Extent extent = _graphic.Shape.Extent; this.Left = (int)Math.Ceiling(extent.minX); this.Top = (int)Math.Ceiling(extent.minY); this.Width = (int)Math.Ceiling((extent.Width)); this.Height = (int)Math.Ceiling((extent.Height)); break; } _updatingSize = false; }