Ejemplo n.º 1
0
 private void CalculateNewSize()
 {
     if (_visual != null)
     {
         _size  = _visual.GetSize(new GraphicsContext(Graphics.FromHwnd(Handle)));
         Width  = Convert.ToInt32(_size.Width);
         Height = Convert.ToInt32(_size.Height);
     }
     Invalidate();
 }
Ejemplo n.º 2
0
            protected override VBox Draw(GraphicsContext context, VBox availableSize)
            {
                var box = Visual.GetSize(context);

                switch (Kind)
                {
                case FrameKind.Rectangle:
                    if (Filled)
                    {
                        context.Graphics.FillRectangle(context.Style.Brush,
                                                       0, 0, box.Width, box.Height);
                    }
                    else
                    {
                        context.Graphics.DrawRectangle(context.Style.Pen,
                                                       0, 0, box.Width, box.Height);
                    }
                    break;

                case FrameKind.Ellipse:
                    if (Filled)
                    {
                        context.Graphics.FillEllipse(context.Style.Brush,
                                                     0, 0, box.Width, box.Height);
                    }
                    else
                    {
                        context.Graphics.DrawEllipse(context.Style.Pen,
                                                     0, 0, box.Width, box.Height);
                    }
                    break;

                case FrameKind.RoundRectangle:
                    if (Filled)
                    {
                        DrawRoundedRectangle(context.Graphics, null, context.Style.Brush,
                                             new RectangleF(0, 0, box.Width, box.Height), 10);
                    }
                    else
                    {
                        DrawRoundedRectangle(context.Graphics, context.Style.Pen, null,
                                             new RectangleF(0, 0, box.Width, box.Height), 10);
                    }
                    break;
                }
                return(base.Draw(context, availableSize));
            }
Ejemplo n.º 3
0
 protected override VBox Draw(GraphicsContext context, VBox availableSize)
 {
     Position = GetAnchorPosition(context.Graphics.Transform, Visual.GetSize(context));
     return(base.Draw(context, availableSize));
 }