/// <summary>
 /// Allocates the control its DirectX resources.
 /// </summary>
 public override void AllocResources()
 {
     base.AllocResources();
     _frameCounter = 0;
     _imageFocused.AllocResources();
     _imageNonFocused.AllocResources();
     _width               = _imageFocused.Width;
     _height              = _imageFocused.Height;
     _labelControl.Width  = _width;
     _labelControl.Height = _height;
     _labelControl.AllocResources();
     _spinControl.AllocResources();
 }
Example #2
0
        /// <summary>
        /// Allocates the control its DirectX resources.
        /// </summary>
        public override void AllocResources()
        {
            base.AllocResources();
            _frameCounter = 0;
            _imageFocused.AllocResources();
            _imageNonFocused.AllocResources();
            _width  = _imageFocused.Width;
            _height = _imageFocused.Height;

            if (SubItemCount > 0)
            {
                Label = (string)GetSubItem(SelectedItem);
            }
            _labelControl.Width  = _width;
            _labelControl.Height = _height;
            _labelControl.AllocResources();
            checkMark.AllocResources();
        }
        public void Render(ref int offsetX, int offsetY, float timePassed)
        {
            _positionX = offsetX;
            if (_control == null)
            {
                return;
            }
            _control.Width  = RenderWidth;
            _control.Height = Row.RenderHeight;

            _control.SetPosition(offsetX, offsetY);

            if (offsetY + Row.RenderHeight > 0 && offsetY < GUIGraphicsContext.Height)
            {
                if (offsetX + RenderWidth >= 0 && offsetX < GUIGraphicsContext.Width)
                {
                    if (_resourcesAllocated == false)
                    {
                        _resourcesAllocated = true;
                        _control.AllocResources();
                    }
                    _control.Render(timePassed);
                }
                else if (_resourcesAllocated)
                {
                    _control.SafeDispose();
                    _resourcesAllocated = false;
                }
            }
            else if (_resourcesAllocated)
            {
                _control.SafeDispose();
                _resourcesAllocated = false;
            }
            offsetX += RenderWidth;
        }