示例#1
0
        /// <summary>
        /// Called when graphics resources need to be loaded.
        /// Use this for the usage of :
        /// - creation of the internal embedded controls.
        /// - setting of the variables and resources in this control
        /// - to load any game-specific graphics resources
        /// - take over the config width and height and use it into State
        /// - overriding how this item looks like , by settings its texture or theme
        /// Call base.LoadContent before you do your override code, this will cause :
        /// - State.SourceRectangle to be reset to the Config.Size
        /// </summary>
        public override void LoadContent()
        {
            base.LoadContent();

            // Horizontal progress-bar
            var x = Theme.ControlLargeSpacing + Theme.ControlHeight + Theme.ControlLargeSpacing;
            var y = Theme.ControlHeight + Theme.ControlLargeSpacing;

            this.Horizontal = new ScrollBarHorizontal(Name + "- Horizontal")
            {
                Config =
                {
                    PositionX = x,
                    PositionY = y
                }
            };
            this.AddControl(this.Horizontal);

            // VerticalScrollbar progress-bar
            x = Theme.ControlLargeSpacing;
            this.ScrollBarVertical = new ScrollBarVertical(Name + "- VerticalScrollbar")
            {
                Config =
                {
                    PositionX = x,
                    PositionY = y
                }
            };
            this.AddControl(this.ScrollBarVertical);

            Config.Width  = this.Horizontal.Config.PositionX + this.Horizontal.Config.Width + (Theme.ControlLargeSpacing * 2);
            Config.Height = this.ScrollBarVertical.Config.PositionY + this.ScrollBarVertical.Config.Height + (Theme.ControlLargeSpacing * 2);
        }
 public override void DrawChildren()
 {
     if (FormChildren != null)
     {
         for (int i = 0; i < FormChildren.Count(); i++)
         {
             if (FormChildren[i] != null)
             {
                 FormChildren[i].Draw();
             }
         }
     }
     if (HasScrollbar)
     {
         if (ScrollBarHorizontal.Active)
         {
             ScrollBarHorizontal.Draw();
         }
         if (ScrollBarVertical.Active)
         {
             ScrollBarVertical.Draw();
         }
     }
 }