Example #1
0
        private void PaintGrid(Graphics graph)
        {
            if (!ShowGrid)
            {
                return;
            }

            Pen pen = new Pen(Color.DarkGray, 1.0f)
            {
                DashStyle = DashStyle.Dot
            };
            int origin = GraphicsMapper.Instance.TransformInt(Ruler.RulerSize.Height);

            graph.TranslateTransform(origin, origin);
            for (int i = 0; i < LayerHeight; i += 50)
            {
                BaseRuler.DrawHorzLine(graph, pen, 0, LayerWidth, i);
            }

            for (int i = 0; i < LayerWidth; i += 50)
            {
                BaseRuler.DrawVertLine(graph, pen, i, 0, LayerHeight);
            }
            graph.TranslateTransform(-origin, -origin);
        }
Example #2
0
        protected override void PrePaint(PaintEventArgs args)
        {
            base.PrePaint(args);

            Point    pt    = GraphicsMapper.Instance.TransformPoint(new Point(ViewConsts.RulerHeight, ViewConsts.RulerHeight));
            Graphics graph = args.Graphics;

            int width  = GraphicsMapper.Instance.TransformInt(ViewConsts.Width);
            int height = GraphicsMapper.Instance.TransformInt(ViewConsts.Height);

#if DEBUG
            BaseRuler.DrawHorzLine(graph, Pens.Black, 0, width, height);
            BaseRuler.DrawVertLine(graph, Pens.Black, width, 0, height);
#endif
            Matrix rotate_at_center = new Matrix();

            rotate_at_center.RotateAt(Rotation, new PointF(width / 2f, height / 2f));
            graph.Transform = rotate_at_center;

            graph.TranslateTransform(-pt.X, -pt.Y);
        }