AllocResources() публичный Метод

Allocates the control its DirectX resources.
public AllocResources ( ) : void
Результат void
Пример #1
0
 protected virtual void AllocButtons()
 {
   for (int i = 0; i < _itemsPerPage; ++i)
   {
     GUIButtonControl cntl = new GUIButtonControl(_controlId, 0, _spinControlPositionX, _spinControlPositionY, _width,
                                                  _itemHeight, _buttonFocusName, _buttonNonFocusName,
                                                  _shadowAngle, _shadowDistance, _shadowColor) {ParentControl = this};
     cntl.SetBorderTF(_strBorderBF,
                      _borderPositionBF,
                      _borderTextureRepeatBF,
                      _borderTextureRotateBF,
                      _borderTextureFileNameBF,
                      _borderColorKeyBF,
                      _borderHasCornersBF,
                      _borderCornerTextureRotateBF);
     cntl.SetBorderTNF(_strBorderBNF,
                       _borderPositionBNF,
                       _borderTextureRepeatBNF,
                       _borderTextureRotateBNF,
                       _borderTextureFileNameBNF,
                       _borderColorKeyBNF,
                       _borderHasCornersBNF,
                       _borderCornerTextureRotateBNF);
     cntl.AllocResources();
     cntl.DimColor = DimColor;
     _listButtons.Add(cntl);
   }
 }
Пример #2
0
    private void Calculate()
    {
      float fWidth = 0, fHeight = 0;

      // height of 1 item = folder image height + text row height + space in between
      _font.GetTextExtent("y", ref fWidth, ref fHeight);

      fWidth = (float)_itemWidth;
      fHeight = (float)_itemHeight;
      float fTotalHeight = (float)(_height - 5);
      _rowCount = (int)(fTotalHeight / fHeight);
      _columnCount = (int)(_width / fWidth);

      int iItemsPerPage = _rowCount * _columnCount;
      int iPages = iItemsPerPage == 0 ? 0 : _listItems.Count / iItemsPerPage;
      if (iItemsPerPage != 0)
      {
        if ((_listItems.Count % iItemsPerPage) != 0)
        {
          iPages++;
        }
      }
      _controlUpDown.SetRange(1, iPages);
      _controlUpDown.Value = 1;

      // Dispose used buttoncontrols
      if (_listButtons != null)
      {
        for (int i = 0; i < _listButtons.Count; ++i)
        {
          GUIButtonControl cntl = _listButtons[i];
          cntl.SafeDispose();
        }
      }
      _listButtons = null;

      if (_listLabels != null)
      {
        for (int i = 0; i < _listLabels.Count; ++i)
        {
          GUIFadeLabel cntl = _listLabels[i];
          cntl.SafeDispose();
        }
      }
      _listLabels = null;

      // Create new buttoncontrols
      _listButtons = new List<GUIButtonControl>();
      _listLabels = new List<GUIFadeLabel>();
      for (int i = 0; i < _columnCount * _rowCount; ++i)
      {
        GUIButtonControl btn = new GUIButtonControl(_parentControlId, _controlId, _positionX, _positionY, _textureWidth,
                                                    _textureHeight, _imageFolderNameFocus, _imageFolderName,
                                                    _shadowAngle, _shadowDistance, _shadowColor);
        btn.ParentControl = this;
        btn.SetFocusedTextureMask(_textureMask);
        btn.SetNonFocusedTextureMask(_textureMask);
        btn.SetHoverTextureMask(_textureMask);
        btn.AllocResources();

        _listButtons.Add(btn);

        GUIFadeLabel fadelabel = new GUIFadeLabel(_parentControlId, _controlId, _positionX, _positionY, _textureWidth,
                                                  _textureHeight, _fontName, _textColor, Alignment.ALIGN_LEFT,
                                                  VAlignment.ALIGN_TOP, _shadowAngle, _shadowDistance, _shadowColor,
                                                  " | ");
        fadelabel.DimColor = DimColor;
        fadelabel.ParentControl = this;
        fadelabel.AllowScrolling = false;
        //fadelabel.AllowFadeIn = false;
        fadelabel.AllocResources();

        _listLabels.Add(fadelabel);
      }
    }
Пример #3
0
      public Key(Xkey key, int iwidth, GUIKeyboard kb)
      {
        xKey = key;
        dwWidth = iwidth;

        // Create a button control template.
        if (button != null)
        {
          button.Dispose();
        }
        button = new GUIButtonControl(kb.GetID, -1, 0, 0, 0, 0, kb._keyTextureFocus, kb._keyTextureNoFocus,
                                      kb._keyTextShadowAngle, kb._keyTextShadowDistance, kb._keyTextShadowColor);

        button.SetBorderTF(
          kb._strBorderKTF,
          kb._borderPositionKTF,
          kb._borderTextureRepeatKTF,
          kb._borderTextureRotateKTF,
          kb._borderTextureFileNameKTF,
          kb._borderColorKeyKTF,
          kb._borderHasCornersKTF,
          kb._borderCornerTextureRotateKTF);

        button.SetBorderTNF(
          kb._strBorderKTNF,
          kb._borderPositionKTNF,
          kb._borderTextureRepeatKTNF,
          kb._borderTextureRotateKTNF,
          kb._borderTextureFileNameKTNF,
          kb._borderColorKeyKTNF,
          kb._borderHasCornersKTNF,
          kb._borderCornerTextureRotateKTNF);

        button.AllocResources();

        // Special keys get their own names
        switch (xKey)
        {
          case Xkey.XK_SPACE:
            name = "SPACE";
            break;
          case Xkey.XK_BACKSPACE:
            name = "BKSP";
            break;
          case Xkey.XK_SHIFT:
            name = "SHIFT";
            break;
          case Xkey.XK_CAPSLOCK:
            name = "CAPS";
            break;
          case Xkey.XK_ALPHABET:
            name = "ALPHABET";
            break;
          case Xkey.XK_SYMBOLS:
            name = "SYMB";
            break;
          case Xkey.XK_ACCENTS:
            name = "ACCENTS";
            break;
          case Xkey.XK_SMS:
            name = "SMS";
            break;
          case Xkey.XK_OK:
            name = GUILocalizeStrings.Get(804);
            break;
          case Xkey.XK_SEARCH_CONTAINS:
            name = GUILocalizeStrings.Get(801);
            break;
          case Xkey.XK_SEARCH_ENDS_WITH:
            name = GUILocalizeStrings.Get(802);
            break;
          case Xkey.XK_SEARCH_START_WITH:
            name = GUILocalizeStrings.Get(800);
            break;
          case Xkey.XK_SEARCH_IS:
            name = GUILocalizeStrings.Get(803);
            break;
          case Xkey.XK_SMS0:
            name = "0 [ ]";
            break;
        }
      }