コード例 #1
0
 protected override void Draw()
 {
     Context2DInternal.BeginLines();
     for (int i = 1; i < Points.Count; i++)
     {
         Context2DInternal.DrawPoint(Points[i - 1]);
         Context2DInternal.DrawPoint(Points[i]);
     }
     Context2DInternal.End();
 }
コード例 #2
0
 void IDrawableInternal.Draw()
 {
     if (Context2DInternal == null)
     {
         throw new Exception();
     }
     if (Visible)
     {
         Context2DInternal.SetColor(Color);
         Draw();
     }
 }
コード例 #3
0
ファイル: AxisDivisions2D.cs プロジェクト: almazsr/Pulsation
        protected override void Draw()
        {
            double current    = Axis.Min;
            double axisLength = Axis.Max - Axis.Min;
            double h          = axisLength / Count;
            double size       = Math.Min(DivisionPersentSize * axisLength, 0.001);

            for (int i = 0; i < Count; i++)
            {
                current += h;
                if (current == 0 &&
                    Axis.Direction == AxisDirection.Y)
                {
                    continue;
                }
                double x, y, nx, ny;
                string label;
                switch (Axis.Direction)
                {
                case AxisDirection.X:
                {
                    x     = current;
                    nx    = 1;
                    ny    = -1;
                    y     = size;
                    label = x.ToString(NumberFormat);
                }
                break;

                case AxisDirection.Y:
                {
                    y     = current;
                    x     = size;
                    nx    = -1;
                    ny    = 1;
                    label = y.ToString(NumberFormat);
                }
                break;

                default:
                    throw new NotImplementedException();
                }
                if (DivisionsVisible)
                {
                    Context2DInternal.DrawVector(new Vector2D(nx * x, ny * y, x, y));
                }
                if (NumbersVisible)
                {
                    Context2DInternal.SetRasterPosition(new Point2D(x, y));
                    Context2DInternal.DrawText(label);
                }
            }
        }