internal CoordinateSystem coordinateSystem; //坐标系 protected GraphicTrackDisplayer(Panel holder) : base(holder) { InitializeDirect2D(holder); //初始化direct2d drawArea = new Rect(0, 0, holder.Width, holder.Height); distance = 5000; // ReSharper disable once VirtualMemberCallInConstructor coordinateSystem = CreateCoordinateSystem(); //最先创建坐标系 background = CreateBackground(); //创建背景 antenna = CreateAntenna(); //创建天线 }
public override void Draw(Bitmap bmp, Rectangle displayArea, float beginAngle, PointF originalPoint) { Graphics drawer = Graphics.FromImage(bmp); //0度线 float degree = -beginAngle; degree = degree % 360; float x = originalPoint.X + ((float)displayArea.Width / 2) * (float)Math.Sin(GraphicTrackDisplayerBackground.DegreeToRadian(degree)); float y = originalPoint.Y - ((float)displayArea.Height / 2) * (float)Math.Cos(GraphicTrackDisplayerBackground.DegreeToRadian(degree)); drawer.DrawLine(ZeroDegreeLinePen, originalPoint, new Point((int)x, (int)y)); //画线 }