Пример #1
0
        protected override void OnRender(DrawingContext context)
        {
            var so   = new Point(TextWrapping == TextWrapping.Wrap ? 0 : (int)_scrollX, (int)_scrollY);
            var cpos =
                _measurement.CaretPosition(_caretPos);

            if (cpos.X >= ActualWidth)
            {
                cpos = new Point(0, cpos.Y + 1);
                if (cpos.Y + so.Y >= ActualHeight)
                {
                    so = so.Offset(0, -1);
                }
            }
            CursorPosition = cpos.Offset(so.X, so.Y)
                             .Offset(context.RenderOffsetX, context.RenderOffsetY);
            context = context.Scroll(so);
            context.Clear(Background);
            context.DrawText(
                new Rectangle(0, 0, ActualWidth, ActualHeight),
                Text,
                new TextOptions
            {
                TextWrapping = TextWrapping,
                Foreground   = Foreground,
                Background   = Background
            });
        }
Пример #2
0
 protected override void OnRender(DrawingContext context)
 {
     context.Clear(Background);
     context.DrawFrame(new Rectangle(0, 0, ActualWidth, ActualHeight),
                       new FrameOptions
     {
         Style      = FrameStyle,
         Foreground = Foreground,
         Background = Background
     });
 }
Пример #3
0
 protected override void OnRender(DrawingContext context)
 {
     context.Clear(Background);
     context.DrawText(
         new Rectangle(0, 0, ActualWidth, ActualHeight),
         Text,
         new TextOptions
     {
         TextWrapping        = TextWrapping,
         Foreground          = Foreground,
         Background          = Background,
         VerticalAlignment   = VerticalTextAlignment,
         HorizontalAlignment = HorizontalTextAlignment
     });
 }
Пример #4
0
            public override void OnRender(DrawingContext dc)
            {
                if (_pushClippingRectangle)
                {
                    try
                    {
                        dc.PushClippingRectangle(x0, y0, xDimension, yDimension);
                    }
                    catch (ArgumentException ex)
                    {
                        Log.Comment("Caught " + ex.Message + " when Pushing a clipping rectangle at (" + x0 + ", " + y0 + ")" +
                                    " and Width = " + xDimension + " Height = " + yDimension);
                        _argumentException = true;
                    }
                }
                if (_popClippingRectangle)
                {
                    dc.PopClippingRectangle();
                }
                if (_getClippingRectangle)
                {
                    dc.GetClippingRectangle(out x1, out y1, out wd, out ht);
                }
                if (_drawLine)
                {
                    dc.DrawLine(_pen, x0, y0, x1, y1);
                }
                if (_drawRectangle)
                {
                    try
                    {
                        dc.DrawRectangle(_brush, _pen, r, s, xDimension, yDimension);
                    }
                    catch (ArgumentException ex)
                    {
                        Log.Comment("Caught " + ex.Message + " when drawing a Rectangle at (" + r + ", " + s + ")" +
                                    " Width = " + xDimension + " Height = " + yDimension);
                        _argumentException = true;
                    }
                }
                if (_drawEllipse)
                {
                    dc.DrawEllipse(_brush, _pen, r, s, xDimension, yDimension);
                }
                if (_drawPolygon)
                {
                    dc.DrawPolygon(_brush, _pen, pts);
                }
                if (_clear)
                {
                    dc.Clear();
                }
                if (_setPixel)
                {
                    dc.SetPixel(_color, r, s);
                }
                if (_drawImage)
                {
                    try
                    {
                        dc.DrawImage(bmp1, r, s);
                    }
                    catch (NullReferenceException ex)
                    {
                        Log.Comment("Caught " + ex.Message + " when drawing a null Image");
                        _nullReferenceException = true;
                    }
                }
                if (_drawCroppedImage)
                {
                    try
                    {
                        dc.DrawImage(bmp1, r, s, x0, y0, xDimension, yDimension);
                    }
                    catch (ArgumentException ex)
                    {
                        Log.Comment("Caught " + ex.Message + " when drawing an Image at (" + r + ", " + s + ")" +
                                    "from a source Image at(" + x0 + ", " + y0 + ") Width = " + xDimension + " Height = " + yDimension);
                        _argumentException = true;
                    }
                    catch (NullReferenceException ex)
                    {
                        Log.Comment("Caught " + ex.Message + " when drawing a null Image");
                        _nullReferenceException = true;
                    }
                }
                if (_translate)
                {
                    dc.Translate(r, s);
                }
                if (_blendImage)
                {
                    dc.BlendImage(bmp2, x0, y0, x1, y1, xDimension, yDimension, _opacity);
                }
                if (_drawText)
                {
                    _textFits = dc.DrawText(ref _str, _font, _color, r, s, xDimension, yDimension, _alignment, _trimming);
                }
                base.OnRender(dc);
                _pBitmap = dc.Bitmap;

                Master_Media.autoEvent.Set();
            }