Exemplo n.º 1
0
        /// <summary>
        /// Renders the GUICheckMarkControl.
        /// </summary>
        public override void Render(float timePassed)
        {
            // Do not render if not visible.
            if (GUIGraphicsContext.EditMode == false)
            {
                if (!IsVisible)
                {
                    base.Render(timePassed);
                    return;
                }
            }

            // Set the selection based on the user specified condition.
            if (_selected.Length != 0)
            {
                try
                {
                    Selected = bool.Parse(GUIPropertyManager.Parse(_selected, GUIExpressionManager.ExpressionOptions.EVALUATE_ALWAYS));
                }
                catch (System.Exception ex)
                {
                    Log.Debug("GUICheckMarkControl: id={0} <selected> expression does not return a boolean value {1}", GetID, ex.Message);
                }
            }

            if (Focus)
            {
                GUIPropertyManager.SetProperty("#highlightedbutton", _label);
            }
            int dwTextPosX      = _positionX;
            int dwCheckMarkPosX = _positionX;

            _rectangle.X      = _positionY;
            _rectangle.Y      = _positionY;
            _rectangle.Height = _imageCheckMarkFocused.Height;
            if (null != _font)
            {
                if (_alignment == Alignment.ALIGN_LEFT)
                {
                    // calculate the position of the checkmark if the text appears at the left side of the checkmark
                    float fTextHeight = 0, fTextWidth = 0;
                    _font.GetTextExtent(_label, ref fTextWidth, ref fTextHeight);
                    dwCheckMarkPosX += ((int)(fTextWidth) + 5);
                    _rectangle.X     = _positionX;
                    _rectangle.Width = 5 + (int)fTextWidth + _imageCheckMarkFocused.Width;
                }
                else
                {
                    // put text at the right side of the checkmark
                    dwTextPosX = (dwCheckMarkPosX + _imageCheckMarkFocused.Width + 5);

                    float fTextHeight = 0, fTextWidth = 0;
                    _font.GetTextExtent(_label, ref fTextWidth, ref fTextHeight);
                    _rectangle.X     = dwTextPosX;
                    _rectangle.Width = (dwTextPosX + (int)fTextWidth + 5) - dwTextPosX;
                }
                if (Disabled)
                {
                    // If disabled, draw the text in the disabled color.
                    _font.DrawText((float)dwTextPosX, (float)_positionY, GUIGraphicsContext.MergeAlpha((uint)_disabledColor), _label, Alignment.ALIGN_LEFT, -1);
                }
                else
                {
                    // Draw focused text and shadow
                    if (Focus)
                    {
                        if (_shadow)
                        {
                            _font.DrawShadowText((float)dwTextPosX, (float)_positionY, GUIGraphicsContext.MergeAlpha((uint)_textColor), _label, Alignment.ALIGN_LEFT, -1, 5,
                                                 5, GUIGraphicsContext.MergeAlpha(0xff000000));
                        }
                        else
                        {
                            _font.DrawText((float)dwTextPosX, (float)_positionY, GUIGraphicsContext.MergeAlpha((uint)_textColor), _label, Alignment.ALIGN_LEFT, -1);
                        }
                    }
                    // Draw non-focused text and shadow
                    else
                    {
                        if (_shadow)
                        {
                            _font.DrawShadowText((float)dwTextPosX, (float)_positionY, GUIGraphicsContext.MergeAlpha((uint)_disabledColor), _label, Alignment.ALIGN_LEFT,
                                                 -1,
                                                 5, 5, GUIGraphicsContext.MergeAlpha(0xff000000));
                        }
                        else
                        {
                            _font.DrawText((float)dwTextPosX, (float)_positionY, GUIGraphicsContext.MergeAlpha((uint)_disabledColor), _label, Alignment.ALIGN_LEFT, -1);
                        }
                    }
                }
            }

            // Render the selected checkmark image
            if (_isSelected)
            {
                _imageCheckMarkFocused.SetPosition(dwCheckMarkPosX, _positionY);
                _imageCheckMarkFocused.Render(timePassed);
            }
            else
            {
                // Render the non-selected checkmark image
                _imageCheckMarkNonFocused.SetPosition(dwCheckMarkPosX, _positionY);
                _imageCheckMarkNonFocused.Render(timePassed);
            }
            base.Render(timePassed);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Renders the control.
        /// </summary>
        public override void Render(float timePassed)
        {
            if (GUIGraphicsContext.EditMode == false)
            {
                if (!IsVisible)
                {
                    base.Render(timePassed);
                    return;
                }
            }
            string  strValue = "";
            float   fRange = 0.0f;
            float   fPos = 0.0f;
            float   fPercent = 0.0f;
            float   fTextWidth = 0, fTextHeight = 0;
            GUIFont _font = GUIFontManager.GetFont(_valueFont);

            switch (_spinType)
            {
            // Float based slider
            case GUISpinControl.SpinType.SPIN_CONTROL_TYPE_FLOAT:
                if (null != _font && _showValue)
                {
                    strValue = String.Format("{0}", _floatValue);
                    _font.DrawText((float)_positionX, (float)_positionY,
                                   _textColor, strValue, Alignment.ALIGN_LEFT, -1);
                    _font.GetTextExtent(strValue, ref fTextWidth, ref fTextHeight);
                    _imageBackGround.SetPosition(_positionX + (int)fTextWidth + 10, _positionY);
                }

                fRange      = (float)(_floatEndValue - _floatStartValue);
                fPos        = (float)(_floatValue - _floatStartValue);
                fPercent    = (fPos / fRange) * 100.0f;
                _percentage = (int)fPercent;
                break;

            // Integer based slider
            case GUISpinControl.SpinType.SPIN_CONTROL_TYPE_INT:
                if (null != _font && _showValue)
                {
                    strValue = String.Format("{0}/{1}", _intValue, _intEndValue);
                    _font.DrawText((float)_positionX, (float)_positionY,
                                   _textColor, strValue, Alignment.ALIGN_LEFT, -1);
                    _font.GetTextExtent(strValue, ref fTextWidth, ref fTextHeight);
                    _imageBackGround.SetPosition(_positionX + (int)fTextWidth + 10, _positionY);
                }

                fRange      = (float)(_intEndValue - _intStartValue);
                fPos        = (float)(_intValue - _intStartValue);
                _percentage = (int)((fPos / fRange) * 100.0f);
                break;
            }

            //int iHeight=25;
            _imageBackGround.Render(timePassed);
            //_imageBackGround.SetHeight(iHeight);
            //_height = _imageBackGround.Height;
            //_width = _imageBackGround.Width + (int)fTextWidth + 10;

            float fWidth = (float)(_imageBackGround.TextureWidth - _imageMid.TextureWidth); //-20.0f;

            fPos  = (float)_percentage;
            fPos /= 100.0f;
            fPos *= fWidth;
            fPos += (float)_imageBackGround.XPosition;
            //fPos += 10.0f;
            if ((int)fWidth > 1)
            {
                if (Focus)
                {
                    _imageMidFocus.SetPosition((int)fPos, _imageBackGround.YPosition);
                    _imageMidFocus.Render(timePassed);
                }
                else
                {
                    _imageMid.SetPosition((int)fPos, _imageBackGround.YPosition);
                    _imageMid.Render(timePassed);
                }
            }
            base.Render(timePassed);
        }
        public override void Render(float timePassed)
        {
            if (GUIGraphicsContext.EditMode == false)
            {
                if (!IsVisible)
                {
                    base.Render(timePassed);
                    return;
                }
                if (Disabled)
                {
                    base.Render(timePassed);
                    return;
                }
            }
            if (_propertyLabel.Length > 0)
            {
                string m_strText = GUIPropertyManager.Parse(_propertyLabel);
                if (m_strText.Length > 0)
                {
                    try
                    {
                        Percentage1 = float.Parse(m_strText);
                    }
                    catch (Exception) {}
                    if (Percentage1 < 0 || Percentage1 > 100)
                    {
                        Percentage1 = 0;
                    }
                }
            }
            if (Label1.Length > 0)
            {
                string strText = GUIPropertyManager.Parse(Label1);
                if (strText.Length > 0)
                {
                    try
                    {
                        Percentage1 = float.Parse(strText);
                    }
                    catch (Exception) {}
                    if (Percentage1 < 0 || Percentage1 > 100)
                    {
                        Percentage1 = 0;
                    }
                }
            }

            if (Label2.Length > 0)
            {
                string strText = GUIPropertyManager.Parse(Label2);
                if (strText.Length > 0)
                {
                    try
                    {
                        Percentage2 = float.Parse(strText);
                    }
                    catch (Exception) {}
                    if (Percentage2 < 0 || Percentage2 > 100)
                    {
                        Percentage2 = 0;
                    }
                }
            }
            if (Label3.Length > 0)
            {
                string strText = GUIPropertyManager.Parse(Label3);
                if (strText.Length > 0)
                {
                    try
                    {
                        Percentage3 = float.Parse(strText);
                    }
                    catch (Exception) {}
                    if (Percentage3 < 0 || Percentage3 > 100)
                    {
                        Percentage3 = 0;
                    }
                }
            }

            int xPos = _positionX;

            _imageLeft.SetPosition(xPos, _positionY);

            xPos = _positionX + _imageLeft.TextureWidth;
            _imageMid.SetPosition(xPos, _positionY);

            int iWidth = _width - (_imageLeft.TextureWidth + _imageRight.TextureWidth);

            _imageMid.Width = iWidth;

            xPos = iWidth + _positionX + _imageLeft.TextureWidth;
            _imageRight.SetPosition(xPos, _positionY);

            _imageLeft.Render(timePassed);
            _imageRight.Render(timePassed);
            _imageMid.Render(timePassed);

            int iWidth1 = 0, iWidth2 = 0, iWidth3 = 0;

            iWidth -= 2 * _fillBackgroundOffsetX;
            float fWidth  = iWidth;
            int   iCurPos = 0;

            // render fillbkg

            xPos = _positionX + _imageLeft.TextureWidth + _fillBackgroundOffsetX;
            _imageFillBackground.Width  = iWidth;
            _imageFillBackground.Height = _imageMid.TextureHeight - _fillBackgroundOffsetY * 2;
            _imageFillBackground.SetPosition(xPos, _positionY + _fillBackgroundOffsetY);
            _imageFillBackground.Render(timePassed);

            // render first color
            int xoff = GUIGraphicsContext.ScaleHorizontal(3);

            xPos = _positionX + _imageLeft.TextureWidth + _fillBackgroundOffsetX + xoff;
            int yPos = _imageFillBackground.YPosition + (_imageFillBackground.Height / 2) - (_fillBackgroundHeight / 2);

            if (yPos < _positionY)
            {
                yPos = _positionY;
            }
            fWidth  = (float)iWidth;
            fWidth /= 100.0f;
            fWidth *= (float)Percentage1;
            iWidth1 = (int)Math.Floor(fWidth);
            if (iWidth1 > 0)
            {
                _imageFill1.Height = _fillBackgroundHeight;
                _imageFill1.Width  = iWidth1;
                _imageFill1.SetPosition(xPos, yPos);
                _imageFill1.Render(timePassed); // red
            }
            iCurPos = iWidth1 + xPos;

            //render 2nd color
            float fPercent;

            if (Percentage2 >= Percentage1)
            {
                fPercent = Percentage2 - Percentage1;
            }
            else
            {
                fPercent = 0;
            }
            fWidth  = (float)iWidth;
            fWidth /= 100.0f;
            fWidth *= (float)fPercent;
            iWidth2 = (int)Math.Floor(fWidth);
            if (iWidth2 > 0)
            {
                _imageFill2.Width  = iWidth2;
                _imageFill2.Height = _fillBackgroundHeight;
                _imageFill2.SetPosition(iCurPos, yPos);
                _imageFill2.Render(timePassed);
            }
            iCurPos = iWidth1 + iWidth2 + xPos;

            if (Percentage3 >= Percentage2)
            {
                //render 3th color
                fPercent = Percentage3 - Percentage2;
            }
            else
            {
                fPercent = 0;
            }
            fWidth  = (float)iWidth;
            fWidth /= 100.0f;
            fWidth *= (float)fPercent;
            iWidth3 = (int)Math.Floor(fWidth);
            if (iWidth3 > 0)
            {
                _imageFill3.Width  = iWidth3;
                _imageFill3.Height = _fillBackgroundHeight;
                _imageFill3.SetPosition(iCurPos, yPos);
                _imageFill3.Render(timePassed);
            }

            // render ticks
            _imageTick.Height = _imageTick.TextureHeight;
            _imageTick.Width  = _imageTick.TextureWidth;
            int posx1 = 10;
            int posx2 = 20;
            int posy1 = 3;

            GUIGraphicsContext.ScaleHorizontal(ref posx1);
            GUIGraphicsContext.ScaleHorizontal(ref posx2);
            GUIGraphicsContext.ScaleVertical(ref posy1);
            for (int i = 0; i <= 100; i += 10)
            {
                float fpos = (float)_positionX + _imageLeft.TextureWidth + posx1;
                fWidth  = (float)(iWidth - posx2);
                fWidth /= 100.0f;
                fWidth *= (float)i;
                _imageTick.SetPosition((int)(fpos + fWidth), (int)_positionY + posy1);
                _imageTick.Render(timePassed);
            }

            // render top
            _imageTop.Height = GUIGraphicsContext.ScaleVertical(_imageTop.TextureHeight);
            _imageTop.Width  = GUIGraphicsContext.ScaleHorizontal(_imageTop.TextureWidth);

            xPos = iCurPos - (_imageTop.Width / 2);
            _imageTop.SetPosition(xPos,
                                  _positionY - _imageTop.Height + _topTextureOffsetY - GUIGraphicsContext.ScaleVertical(1));
            _imageTop.Render(timePassed);

            //render tick @ current position
            _imageTick.Height = _imageFillBackground.TextureHeight;
            _imageTick.Width  = _imageTick.TextureWidth * 2;
            _imageTick.SetPosition((int)(_imageTop.XPosition + (_imageTop.TextureWidth / 2) - (_imageTick.Width / 2)),
                                   (int)_imageFillBackground.YPosition);
            _imageTick.Render(timePassed);

            // render bottom
            xPos = _imageTop.XPosition + (_imageTop.TextureWidth / 2) - (_imageBottom.TextureWidth / 2);
            _imageBottom.SetPosition(xPos, _positionY + _imageMid.TextureHeight);
            _imageBottom.Render(timePassed);


            //render logo
            float fx = (float)_imageBottom.XPosition;

            fx += (((float)_imageBottom.TextureWidth) / 2f);
            fx -= (((float)_imageLogo.TextureWidth) / 2f);

            float fy = (float)_imageBottom.YPosition;

            fy += (((float)_imageBottom.TextureHeight) / 2f);
            fy -= (((float)_imageLogo.TextureHeight) / 2f);
            _imageLogo.SetPosition((int)fx, (int)fy);
            _imageLogo.Render(timePassed);

            if (_font != null)
            {
                float  fW = 0, fH = 0;
                float  fHeight = 0;
                string strText = "";

                // render top text
                if (_labelTop.Length > 0)
                {
                    strText = GUIPropertyManager.Parse(_labelTop);
                    _font.GetTextExtent(strText, ref fW, ref fH);
                    fW      /= 2.0f;
                    fH      /= 2.0f;
                    fWidth   = ((float)_imageTop.TextureWidth) / 2.0f;
                    fHeight  = ((float)_imageTop.TextureHeight) / 2.0f;
                    fWidth  -= fW;
                    fHeight -= fH;
                    _font.DrawText((float)_imageTop.XPosition + fWidth, (float)2 + _imageTop.YPosition + fHeight, _textColor,
                                   strText, Alignment.ALIGN_LEFT, -1);
                }


                // render left text
                if (_labelLeft.Length > 0)
                {
                    strText = GUIPropertyManager.Parse(_labelLeft);
                    _font.GetTextExtent(strText, ref fW, ref fH);
                    fW      /= 2.0f;
                    fH      /= 2.0f;
                    fWidth   = ((float)_imageLeft.TextureWidth) / 2.0f;
                    fHeight  = ((float)_imageLeft.TextureHeight) / 2.0f;
                    fWidth  -= fW;
                    fHeight -= fH;
                    _font.DrawText((float)_positionX + fWidth, (float)_positionY + fHeight, _textColor, strText,
                                   Alignment.ALIGN_LEFT, -1);
                }

                // render right text
                if (_labelRight.Length > 0)
                {
                    strText = GUIPropertyManager.Parse(_labelRight);
                    _font.GetTextExtent(strText, ref fW, ref fH);
                    fW      /= 2.0f;
                    fH      /= 2.0f;
                    fWidth   = ((float)_imageRight.TextureWidth) / 2.0f;
                    fHeight  = ((float)_imageRight.TextureHeight) / 2.0f;
                    fWidth  -= fW;
                    fHeight -= fH;
                    _font.DrawText((float)_imageRight.XPosition + fWidth, (float)_imageRight.YPosition + fHeight, _textColor,
                                   strText, Alignment.ALIGN_LEFT, -1);
                }
            }
            base.Render(timePassed);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Renders the GUICheckMarkControl.
        /// </summary>
        public override void Render(float timePassed)
        {
            // Do not render if not visible.
            if (GUIGraphicsContext.EditMode == false)
            {
                if (!IsVisible)
                {
                    base.Render(timePassed);
                    return;
                }
            }
            if (Focus)
            {
                GUIPropertyManager.SetProperty("#highlightedbutton", _label);
            }
            int dwTextPosX      = _positionX;
            int dwCheckMarkPosX = _positionX;

            _rectangle.X      = _positionY;
            _rectangle.Y      = _positionY;
            _rectangle.Height = _imageCheckMarkFocused.Height;
            if (null != _font)
            {
                if (_alignment == Alignment.ALIGN_LEFT)
                {
                    // calculate the position of the checkmark if the text appears at the left side of the checkmark
                    float fTextHeight = 0, fTextWidth = 0;
                    _font.GetTextExtent(_label, ref fTextWidth, ref fTextHeight);
                    dwCheckMarkPosX += ((int)(fTextWidth) + 5);
                    _rectangle.X     = _positionX;
                    _rectangle.Width = 5 + (int)fTextWidth + _imageCheckMarkFocused.Width;
                }
                else
                {
                    // put text at the right side of the checkmark
                    dwTextPosX = (dwCheckMarkPosX + _imageCheckMarkFocused.Width + 5);

                    float fTextHeight = 0, fTextWidth = 0;
                    _font.GetTextExtent(_label, ref fTextWidth, ref fTextHeight);
                    _rectangle.X     = dwTextPosX;
                    _rectangle.Width = (dwTextPosX + (int)fTextWidth + 5) - dwTextPosX;
                }
                if (Disabled)
                {
                    // If disabled, draw the text in the disabled color.
                    _font.DrawText((float)dwTextPosX, (float)_positionY, GUIGraphicsContext.MergeAlpha((uint)_disabledColor), _label, Alignment.ALIGN_LEFT, -1);
                }
                else
                {
                    // Draw focused text and shadow
                    if (Focus)
                    {
                        if (_shadow)
                        {
                            _font.DrawShadowText((float)dwTextPosX, (float)_positionY, GUIGraphicsContext.MergeAlpha((uint)_textColor), _label, Alignment.ALIGN_LEFT, -1, 5,
                                                 5, GUIGraphicsContext.MergeAlpha(0xff000000));
                        }
                        else
                        {
                            _font.DrawText((float)dwTextPosX, (float)_positionY, GUIGraphicsContext.MergeAlpha((uint)_textColor), _label, Alignment.ALIGN_LEFT, -1);
                        }
                    }
                    // Draw non-focused text and shadow
                    else
                    {
                        if (_shadow)
                        {
                            _font.DrawShadowText((float)dwTextPosX, (float)_positionY, GUIGraphicsContext.MergeAlpha((uint)_disabledColor), _label, Alignment.ALIGN_LEFT,
                                                 -1,
                                                 5, 5, GUIGraphicsContext.MergeAlpha(0xff000000));
                        }
                        else
                        {
                            _font.DrawText((float)dwTextPosX, (float)_positionY, GUIGraphicsContext.MergeAlpha((uint)_disabledColor), _label, Alignment.ALIGN_LEFT, -1);
                        }
                    }
                }
            }

            // Render the selected checkmark image
            if (_isSelected)
            {
                _imageCheckMarkFocused.SetPosition(dwCheckMarkPosX, _positionY);
                _imageCheckMarkFocused.Render(timePassed);
            }
            else
            {
                // Render the non-selected checkmark image
                _imageCheckMarkNonFocused.SetPosition(dwCheckMarkPosX, _positionY);
                _imageCheckMarkNonFocused.Render(timePassed);
            }
            base.Render(timePassed);
        }
        public override void Render(float timePassed)
        {
            if (GUIGraphicsContext.EditMode == false)
            {
                if (!IsVisible)
                {
                    base.Render(timePassed);
                    return;
                }
                if (Disabled)
                {
                    base.Render(timePassed);
                    return;
                }
            }
            if (_propertyLabel.Length > 0)
            {
                string m_strText = GUIPropertyManager.Parse(_propertyLabel);
                if (m_strText.Length > 0 && !m_strText.Contains(@"#"))
                {
                    try
                    {
                        Percentage1 = float.Parse(m_strText);
                    }
                    catch (Exception ex)
                    {
                        Log.Error("GUITVProgressControl: Render() {0}", ex.Message);
                    }
                    if (Percentage1 < 0 || Percentage1 > 100)
                    {
                        Percentage1 = 0;
                    }
                }
            }
            if (Label1.Length > 0)
            {
                string strText = GUIPropertyManager.Parse(Label1);
                if (strText.Length > 0 && !strText.Contains(@"#"))
                {
                    try
                    {
                        Percentage1 = float.Parse(strText);
                    }
                    catch (Exception ex)
                    {
                        Log.Error("GUITVProgressControl: Render2() {0}", ex.Message);
                    }

                    if (Percentage1 < 0 || Percentage1 > 100)
                    {
                        Percentage1 = 0;
                    }
                }
            }

            if (Label2.Length > 0)
            {
                string strText = GUIPropertyManager.Parse(Label2);
                if (strText.Length > 0 && !strText.Contains(@"#"))
                {
                    try
                    {
                        Percentage2 = float.Parse(strText);
                    }
                    catch (Exception ex)
                    {
                        Log.Error("GUITVProgressControl: Render3() {0}", ex.Message);
                    }
                    if (Percentage2 < 0 || Percentage2 > 100)
                    {
                        Percentage2 = 0;
                    }
                }
            }
            if (Label3.Length > 0)
            {
                string strText = GUIPropertyManager.Parse(Label3);
                if (strText.Length > 0 && !strText.Contains(@"#"))
                {
                    try
                    {
                        Percentage3 = float.Parse(strText);
                    }
                    catch (Exception ex)
                    {
                        Log.Error("GUITVProgressControl: Render4() {0}", ex.Message);
                    }
                    if (Percentage3 < 0 || Percentage3 > 100)
                    {
                        Percentage3 = 0;
                    }
                }
            }

            //parse labels for markers
            //only going to parse if the values are different than the current value
            string tempStarts = GUIPropertyManager.Parse(LabelMarkerStarts);
            string tempEnds   = GUIPropertyManager.Parse(LabelMarkerEnds);

            if (_markerStarts != tempStarts || _markerEnds != tempEnds)
            {
                parseMarkerValues(tempStarts, tempEnds);
                _markerStarts = tempStarts;
                _markerEnds   = tempEnds;
            }

            int iWidthLeft   = _imageLeft.TextureWidth;
            int iHeightLeft  = _imageLeft.TextureHeight;
            int iWidthRight  = _imageRight.TextureWidth;
            int iHeightRight = _imageRight.TextureHeight;

            GUIGraphicsContext.ScaleHorizontal(ref iWidthLeft);
            GUIGraphicsContext.ScaleHorizontal(ref iWidthRight);
            GUIGraphicsContext.ScaleVertical(ref iHeightLeft);
            GUIGraphicsContext.ScaleVertical(ref iHeightRight);

            int xPos = _positionX;

            _imageLeft.SetPosition(xPos, _positionY);

            _imageLeft.Height = iHeightLeft;
            _imageLeft.Width  = iWidthLeft;

            xPos = _positionX + iWidthLeft;
            _imageMid.SetPosition(xPos, _positionY);

            int iWidth = _width - (iWidthLeft + iWidthRight);

            _imageMid.Width = iWidth;

            xPos = iWidth + _positionX + iWidthLeft;
            _imageRight.SetPosition(xPos, _positionY);

            _imageRight.Height = iHeightRight;
            _imageRight.Width  = iWidthRight;

            _imageLeft.Render(timePassed);
            _imageRight.Render(timePassed);
            _imageMid.Render(timePassed);

            int iWidth1 = 0, iWidth2 = 0, iWidth3 = 0;

            iWidth -= 2 * _fillBackgroundOffsetX;
            float fWidth  = iWidth;
            int   iCurPos = 0;

            // render fillbkg

            xPos = _positionX + iWidthLeft + _fillBackgroundOffsetX;
            _imageFillBackground.Width  = iWidth;
            _imageFillBackground.Height = _imageMid.TextureHeight - _fillBackgroundOffsetY * 2;
            _imageFillBackground.SetPosition(xPos, _positionY + _fillBackgroundOffsetY);
            _imageFillBackground.Render(timePassed);


            int xoff = GUIGraphicsContext.ScaleHorizontal(3);

            xPos = _positionX + iWidthLeft + _fillBackgroundOffsetX + xoff;
            int yPos = _imageFillBackground.YPosition + (_imageFillBackground.Height / 2) - (_fillBackgroundHeight / 2);

            iWidth -= 2 * xoff;
            if (yPos < _positionY)
            {
                yPos = _positionY;
            }
            //render commercial markers
            fWidth  = (float)iWidth;
            fWidth /= 100.0f;
            calculateMarkerSizeAndPosition(xPos, yPos, fWidth);
            for (int i = 0; i < _markerYPositions.Count || i < _markerXPositions.Count || i < _markerWidths.Count; i++)
            {
                _imageFillMarker.Width = _markerWidths[i];
                _imageFillMarker.SetPosition(_markerXPositions[i], _markerYPositions[i]);
                _imageFillMarker.Render(timePassed);
            }

            //render first color
            xPos    = _positionX + _imageLeft.TextureWidth + _fillBackgroundOffsetX + xoff;
            fWidth  = (float)iWidth;
            fWidth /= 100.0f;
            fWidth *= (float)Percentage1;
            iWidth1 = (int)Math.Floor(fWidth);
            if (iWidth1 > 0)
            {
                _imageFill1.Height = _fillBackgroundHeight;
                _imageFill1.Width  = iWidth1;
                _imageFill1.SetPosition(xPos, yPos);
                _imageFill1.Render(timePassed); // red
            }
            iCurPos = iWidth1 + xPos;

            //render 2nd color
            float fPercent;

            if (Percentage2 >= Percentage1)
            {
                fPercent = Percentage2 - Percentage1;
            }
            else
            {
                fPercent = 0;
            }
            fWidth  = (float)iWidth;
            fWidth /= 100.0f;
            fWidth *= (float)fPercent;
            iWidth2 = (int)Math.Floor(fWidth);
            if (iWidth2 > 0)
            {
                _imageFill2.Width  = iWidth2;
                _imageFill2.Height = _fillBackgroundHeight;
                _imageFill2.SetPosition(iCurPos, yPos);
                _imageFill2.Render(timePassed);
            }
            iCurPos = iWidth1 + iWidth2 + xPos;

            if (Percentage3 >= Percentage2)
            {
                //render 3th color
                fPercent = Percentage3 - Percentage2;
            }
            else
            {
                fPercent = 0;
            }
            fWidth  = (float)iWidth;
            fWidth /= 100.0f;
            fWidth *= (float)fPercent;
            iWidth3 = (int)Math.Floor(fWidth);
            if (iWidth3 > 0)
            {
                _imageFill3.Width  = iWidth3;
                _imageFill3.Height = _fillBackgroundHeight;
                _imageFill3.SetPosition(iCurPos, yPos);
                _imageFill3.Render(timePassed);
            }

            // render ticks
            _imageTick.Height = _imageTick.TextureHeight;
            _imageTick.Width  = _imageTick.TextureWidth;
            int posx1 = 10;
            int posx2 = 20;
            int posy1 = 3;

            GUIGraphicsContext.ScaleHorizontal(ref posx1);
            GUIGraphicsContext.ScaleHorizontal(ref posx2);
            GUIGraphicsContext.ScaleVertical(ref posy1);
            for (int i = 0; i <= 100; i += 10)
            {
                float fpos = (float)_positionX + iWidthLeft + posx1;
                fWidth  = (float)(iWidth - posx2);
                fWidth /= 100.0f;
                fWidth *= (float)i;
                _imageTick.SetPosition((int)(fpos + fWidth), (int)_positionY + posy1);
                _imageTick.Render(timePassed);
            }

            // render top
            _imageTop.Height = GUIGraphicsContext.ScaleVertical(_imageTop.TextureHeight);
            _imageTop.Width  = GUIGraphicsContext.ScaleHorizontal(_imageTop.TextureWidth);

            xPos = iCurPos - (_imageTop.Width / 2);
            _imageTop.SetPosition(xPos,
                                  _positionY - _imageTop.Height + _topTextureOffsetY - GUIGraphicsContext.ScaleVertical(1));
            _imageTop.Render(timePassed);

            //render tick @ current position
            _imageTick.Height = _imageFillBackground.TextureHeight;
            _imageTick.Width  = _imageTick.TextureWidth * 2;
            _imageTick.SetPosition((int)(_imageTop.XPosition + (_imageTop.TextureWidth / 2) - (_imageTick.Width / 2)),
                                   (int)_imageFillBackground.YPosition);
            _imageTick.Render(timePassed);

            // render bottom
            _imageBottom.Height = GUIGraphicsContext.ScaleVertical(_imageBottom.TextureHeight);
            _imageBottom.Width  = GUIGraphicsContext.ScaleHorizontal(_imageBottom.TextureWidth);

            xPos = _imageTop.XPosition + (_imageTop.Width / 2) - (_imageBottom.Width / 2);
            _imageBottom.SetPosition(xPos, _positionY + _imageMid.Height);
            _imageBottom.Render(timePassed);


            //render logo
            _imageLogo.Height = GUIGraphicsContext.ScaleVertical(_imageLogo.TextureHeight);
            _imageLogo.Width  = GUIGraphicsContext.ScaleHorizontal(_imageLogo.TextureWidth);
            float fx = (float)_imageBottom.XPosition;

            fx += (((float)_imageBottom.Width) / 2f);
            fx -= (((float)_imageLogo.TextureWidth) / 2f);

            float fy = (float)_imageBottom.YPosition;

            fy += (((float)_imageBottom.Height) / 2f);
            fy -= (((float)_imageLogo.Height) / 2f);
            _imageLogo.SetPosition((int)fx, (int)fy);
            _imageLogo.Render(timePassed);

            if (_font != null)
            {
                float  fW = 0, fH = 0;
                float  fHeight = 0;
                string strText = "";

                // render top text
                if (_labelTop.Length > 0)
                {
                    strText = GUIPropertyManager.Parse(_labelTop);
                    _font.GetTextExtent(strText, ref fW, ref fH);
                    fW      /= 2.0f;
                    fH      /= 2.0f;
                    fWidth   = ((float)_imageTop.Width) / 2.0f;
                    fHeight  = ((float)_imageTop.Height) / 2.0f;
                    fWidth  -= fW;
                    fHeight -= fH;
                    _font.DrawText((float)_imageTop.XPosition + fWidth, (float)2 + _imageTop.YPosition + fHeight, _textColor,
                                   strText, Alignment.ALIGN_LEFT, -1);
                }


                // render left text
                if (_labelLeft.Length > 0)
                {
                    strText = GUIPropertyManager.Parse(_labelLeft);
                    _font.GetTextExtent(strText, ref fW, ref fH);
                    fW      /= 2.0f;
                    fH      /= 2.0f;
                    fWidth   = ((float)iWidthLeft) / 2.0f;
                    fHeight  = ((float)iHeightLeft) / 2.0f;
                    fWidth  -= fW;
                    fHeight -= fH;
                    _font.DrawText((float)_positionX + fWidth, (float)_positionY + fHeight, _textColor, strText,
                                   Alignment.ALIGN_LEFT, -1);
                }

                // render right text
                if (_labelRight.Length > 0)
                {
                    strText = GUIPropertyManager.Parse(_labelRight);
                    _font.GetTextExtent(strText, ref fW, ref fH);
                    fW      /= 2.0f;
                    fH      /= 2.0f;
                    fWidth   = ((float)iWidthRight) / 2.0f;
                    fHeight  = ((float)iHeightRight) / 2.0f;
                    fWidth  -= fW;
                    fHeight -= fH;
                    _font.DrawText((float)_imageRight.XPosition + fWidth, (float)_imageRight.YPosition + fHeight, _textColor,
                                   strText, Alignment.ALIGN_LEFT, -1);
                }
            }
            base.Render(timePassed);
        }