Ejemplo n.º 1
0
        public override void OnDraw(GraphicContext gc)
        {
            gc.AddMargin(Margin);

            if (IsVisible)
            {
                if (StartPosition == WindowStartPosition.CenterScreen)
                {
                    Location = new Point(gc.Size.Width / 2 - Size.Width / 2, gc.Size.Height / 2 - Size.Height / 2);
                }

                if (IsTitleBarVisible)
                {
                    // draw titlebar
                    gc.FillRectangle(new Rectangle(Location, new Size(Size.Width, 30)), TitleBarColor);
                }
                else
                {
                    // remove title bar offset
                    Location -= new Point(0, 30);
                }

                // draw content area
                gc.FillRectangle(new Rectangle(Location + new Point(0, 30), Size), Background);
                //draw children on new GraphicContext for ContentArea
                foreach (var w in Children)
                {
                    var cgc = new GraphicContext();
                    cgc.SetParent(gc);
                    cgc.OffSet = Location;

                    w.OnDraw(cgc);
                }
            }
        }
Ejemplo n.º 2
0
        public override void OnDraw(GraphicContext gc)
        {
            base.OnDraw(gc);

            var g = new GraphicContext();

            g.OffSet = Location;
            g.SetParent(gc);

            foreach (var w in Children)
            {
                w.OnDraw(g);
            }
        }