public override void Draw(DrawContext context)
 {
     // To render the scrolled panel, we just adjust our offset before rendering our child controls as
     // a normal PanelControl
     context.DrawOffset.Y = -scrollTracker.ViewRect.Y;
     base.Draw(context);
 }
Example #2
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="context"></param>
 public virtual void Draw(DrawContext context)
 {
     Vector2 origin = context.DrawOffset;
     for(int i=0; i<ChildCount; i++)
     {
         Control child = children[i];
         if (child.Visible)
         {
             context.DrawOffset = origin + child.Position;
             child.Draw(context);
         }
     }
 }
Example #3
0
        public override void Draw(DrawContext context)
        {
            base.Draw(context);

            context.SpriteBatch.DrawString(font, Text, context.DrawOffset, Color);
        }
Example #4
0
        public override void Draw(DrawContext context)
        {
            base.Draw(context);
            Texture2D drawTexture = texture ?? context.BlankTexture;

            Vector2 actualSourceSize = SourceSize ?? Size;
            Rectangle sourceRectangle = new Rectangle
            {
                X = (int)origin.X,
                Y = (int)origin.Y,
                Width = (int)actualSourceSize.X,
                Height = (int)actualSourceSize.Y,
            };
            Rectangle destRectangle = new Rectangle
            {
                X = (int)context.DrawOffset.X,
                Y = (int)context.DrawOffset.Y,
                Width = (int)Size.X,
                Height = (int)Size.Y
            };
            context.SpriteBatch.Draw(drawTexture, destRectangle, sourceRectangle, Color);
        }