示例#1
0
 protected void BeginBox(DrawingContext dc, int boxNumber, BoxOptions options)
 {
   BeginBox(dc, boxNumber, options, null);
 }
示例#2
0
    /// <summary>
    /// Translates origin of coordinate space to a box of size 220pp x 140pp.
    /// </summary>
    protected void BeginBox(DrawingContext dc, int n, BoxOptions options, string description)
    {
      double dx = (WidthInPU - 2 * BoxWidth) / 3;
      double dy = (HeightInPU - 4 * BoxHeight) / 5;
      double x = (1 - n % 2) * BoxWidth + (2 - n % 2) * dx;
      double y = ((n + 1) / 2 - 1) * BoxHeight + ((n + 1) / 2) * dy;
      dc.PushTransform(new TranslateTransform(x, y));

      Brush tileBrush = new SolidColorBrush(Color.FromRgb(204, 204, 204));
      //if (options != BoxOptions.None)
      //{
      //  double strokeWidth = 0.75;
      //  double adjust = strokeWidth / 2;
      //  Pen pen = new Pen(tileBrush, 0.75);
      //  //pen.DashStyle = DashStyles.DashDot;
      //  dc.DrawRectangle(null, pen, new Rect(0 + adjust, 0 + adjust, BoxWidth - strokeWidth, BoxHeight - strokeWidth));
      //}
      switch (options)
      {
        case BoxOptions.None:
          break;

        case BoxOptions.Box:
          {
            Pen pen = new Pen(tileBrush, 3);
            dc.DrawLine(pen, new Point(0, 0), new Point(BoxWidth, 0));
            dc.DrawLine(pen, new Point(BoxWidth, 0), new Point(BoxWidth, BoxHeight));
            dc.DrawLine(pen, new Point(BoxWidth, BoxHeight), new Point(0, BoxHeight));
            dc.DrawLine(pen, new Point(0, BoxHeight), new Point(0, 0));
          }
          break;

        case BoxOptions.DrawX:
          {
            Pen pen = new Pen(tileBrush, 3);
            dc.DrawLine(pen, new Point(0, 0), new Point(BoxWidth, BoxHeight));
            dc.DrawLine(pen, new Point(0, BoxHeight), new Point(BoxWidth, 0));
          }
          break;

        case BoxOptions.Fill:
          {
            dc.DrawRectangle(tileBrush, null, new Rect(0, 0, BoxWidth, BoxHeight));
          }
          break;

        case BoxOptions.Tile:
          {
#if true
            double delta = 8;
            PathGeometry path = new PathGeometry();
            for (double xx = 0; xx < BoxWidth; xx += 2 * delta)
              path.AddGeometry(new RectangleGeometry(new Rect(xx, 0, delta, BoxHeight)));
            for (double yy = 0; yy < BoxHeight; yy += 2 * delta)
              path.AddGeometry(new RectangleGeometry(new Rect(0, yy, BoxWidth, delta)));
            dc.DrawGeometry(tileBrush, null, path);
#else
            double delta = 5;
            bool draw1 = true;
            for (double yy = 0; yy < BoxHeight; yy += delta, draw1 = !draw1)
            {
              bool draw2 = true;
              for (double xx = 0; xx < BoxWidth; xx += delta, draw2 = !draw2)
                if ((draw1 && draw2) || (!draw1 && !draw2))
                  dc.DrawRectangle(tileBrush, null, new Rect(xx, yy, delta, delta));
            }
#endif
          }
          break;
      }
      if (options != BoxOptions.None && !String.IsNullOrEmpty(description))
        dc.DrawText(new FormattedText(description, CultureInfo.InvariantCulture, FlowDirection.LeftToRight, new Typeface("Arial"), 7.5, Brushes.Black), new Point(0, BoxHeight + 0));
    }
示例#3
0
        /// <summary>
        /// Translates origin of coordinate space to a box of size 220pp x 140pp.
        /// </summary>
        protected void BeginBox(DrawingContext dc, int n, BoxOptions options, string description)
        {
            double dx = (WidthInPU - 2 * BoxWidth) / 3;
            double dy = (HeightInPU - 4 * BoxHeight) / 5;
            double x  = (1 - n % 2) * BoxWidth + (2 - n % 2) * dx;
            double y  = ((n + 1) / 2 - 1) * BoxHeight + ((n + 1) / 2) * dy;

            dc.PushTransform(new TranslateTransform(x, y));

            Brush tileBrush = new SolidColorBrush(Color.FromRgb(204, 204, 204));

            //if (options != BoxOptions.None)
            //{
            //  double strokeWidth = 0.75;
            //  double adjust = strokeWidth / 2;
            //  Pen pen = new Pen(tileBrush, 0.75);
            //  //pen.DashStyle = DashStyles.DashDot;
            //  dc.DrawRectangle(null, pen, new Rect(0 + adjust, 0 + adjust, BoxWidth - strokeWidth, BoxHeight - strokeWidth));
            //}
            switch (options)
            {
            case BoxOptions.None:
                break;

            case BoxOptions.Box:
            {
                Pen pen = new Pen(tileBrush, 3);
                dc.DrawLine(pen, new Point(0, 0), new Point(BoxWidth, 0));
                dc.DrawLine(pen, new Point(BoxWidth, 0), new Point(BoxWidth, BoxHeight));
                dc.DrawLine(pen, new Point(BoxWidth, BoxHeight), new Point(0, BoxHeight));
                dc.DrawLine(pen, new Point(0, BoxHeight), new Point(0, 0));
            }
            break;

            case BoxOptions.DrawX:
            {
                Pen pen = new Pen(tileBrush, 3);
                dc.DrawLine(pen, new Point(0, 0), new Point(BoxWidth, BoxHeight));
                dc.DrawLine(pen, new Point(0, BoxHeight), new Point(BoxWidth, 0));
            }
            break;

            case BoxOptions.Fill:
            {
                dc.DrawRectangle(tileBrush, null, new Rect(0, 0, BoxWidth, BoxHeight));
            }
            break;

            case BoxOptions.Tile:
            {
#if true
                double       delta = 8;
                PathGeometry path  = new PathGeometry();
                for (double xx = 0; xx < BoxWidth; xx += 2 * delta)
                {
                    path.AddGeometry(new RectangleGeometry(new Rect(xx, 0, delta, BoxHeight)));
                }
                for (double yy = 0; yy < BoxHeight; yy += 2 * delta)
                {
                    path.AddGeometry(new RectangleGeometry(new Rect(0, yy, BoxWidth, delta)));
                }
                dc.DrawGeometry(tileBrush, null, path);
#else
                double delta = 5;
                bool   draw1 = true;
                for (double yy = 0; yy < BoxHeight; yy += delta, draw1 = !draw1)
                {
                    bool draw2 = true;
                    for (double xx = 0; xx < BoxWidth; xx += delta, draw2 = !draw2)
                    {
                        if ((draw1 && draw2) || (!draw1 && !draw2))
                        {
                            dc.DrawRectangle(tileBrush, null, new Rect(xx, yy, delta, delta));
                        }
                    }
                }
#endif
            }
            break;
            }
            if (options != BoxOptions.None && !String.IsNullOrEmpty(description))
            {
                dc.DrawText(new FormattedText(description, CultureInfo.InvariantCulture, FlowDirection.LeftToRight, new Typeface("Arial"), 7.5, Brushes.Black), new Point(0, BoxHeight + 0));
            }
        }
示例#4
0
 protected void BeginBox(DrawingContext dc, int boxNumber, BoxOptions options)
 {
     BeginBox(dc, boxNumber, options, null);
 }
示例#5
0
 public IEnumerator Load(BoxOptions hs)
 {
     yield return(null);
 }