Ejemplo n.º 1
0
        protected override void OnPaint(PaintEventArgs e)
        {
            if (Services == null)
            {
                Debug.Print("TextView.OnPaint: Services property must be set");
                return;
            }
            GetStyleStack().PushStyle(StyleClass);
            var painter = new TextViewPainter(layout, e.Graphics, ForeColor, BackColor, Font, styleStack);

            painter.SetSelection(GetStartSelection(), GetEndSelection());

            painter.PaintGdi();
            GetStyleStack().PopStyle();
        }
Ejemplo n.º 2
0
        public bool DrawNode(Node node, object graphics)
        {
            Graphics g = (Graphics)graphics;

            var m = g.Transform;
            var saveM = g.Transform.Clone();
            //      g.SetClip(FillTheGraphicsPath(node.GeometryNode.BoundaryCurve));

            // This is supposed to flip the text around its center

            var c = (float)node.GeometryNode.Center.Y;
            using (var m2 = new System.Drawing.Drawing2D.Matrix(1, 0, 0, -1, 0, 2 * c))
            {
                m.Multiply(m2);
            }

            m.Translate(
                (float)node.GeometryNode.Center.X,
                (float)node.GeometryNode.Center.Y);

            g.Transform = m;

            var styleStack = GetStyleStack();
            var painter = new TextViewPainter(
                Layout, g,
                SystemColors.WindowText,
                SystemColors.Window,
                SystemFonts.DefaultFont, styleStack);
            var ptr = new TextPointer { Character = 0, Span = 0, Line = TextModel.StartPosition };
            painter.SetSelection(ptr, ptr);
            painter.PaintGdiPlus();
            g.Transform = saveM;
            g.ResetClip();

            saveM.Dispose();
       //     m.Dispose();
            return true;//returning false would enable the default rendering
        }
Ejemplo n.º 3
0
        protected override void OnPaint(PaintEventArgs e)
        {
            if (Services == null)
            {
                Debug.Print("TextView.OnPaint: Services property must be set");
                return;
            }
            GetStyleStack().PushStyle(StyleClass);
            var painter = new TextViewPainter(layout, e.Graphics, ForeColor, BackColor, Font, styleStack);
            painter.SetSelection(GetStartSelection(), GetEndSelection());

            painter.PaintGdi();
            GetStyleStack().PopStyle();
        }