示例#1
0
 /// <summary>
 /// Frees the control its DirectX resources.
 /// </summary>
 public override void Dispose()
 {
     base.Dispose();
     _imageFocused.SafeDispose();
     _imageNonFocused.SafeDispose();
     _labelControl.SafeDispose();
     checkMark.SafeDispose();
 }
示例#2
0
 public override void Dispose()
 {
     base.Dispose();
     _imageFocused.SafeDispose();
     _imageNonFocused.SafeDispose();
     _imageAlternativeFocused.SafeDispose();
     _imageAlternativeNonFocused.SafeDispose();
     _labelControl.SafeDispose();
 }
示例#3
0
        /// <summary>
        /// Frees the control its DirectX resources.
        /// </summary>
        public override void Dispose()
        {
            //UnsubscribeEventHandlers();

            base.Dispose();
            _imageFocused.SafeDispose();
            _imageNonFocused.SafeDispose();
            _imageBackground.SafeDispose();
            _imageLeft.SafeDispose();
            _imageLeftFocus.SafeDispose();
            _imageRight.SafeDispose();
            _imageRightFocus.SafeDispose();
            _labelControl.SafeDispose();
            _font = null;

            _showSelect = false;

            Clear();
        }
    private void WordWrapText(string strText, int iMaxWidth, out ArrayList wrappedLines)
    {
      wrappedLines = new ArrayList();
      GUILabelControl cntl1 = new GUILabelControl(_controlId, 0, 0, 0, GUIGraphicsContext.Width,
                                                  GUIGraphicsContext.Height, _fontName, "", _textColor,
                                                  Alignment.ALIGN_LEFT, VAlignment.ALIGN_TOP, false,
                                                  _shadowAngle, _shadowDistance, _shadowColor) {ParentControl = this};
      cntl1.AllocResources();

      // start wordwrapping
      // Set a flag so we can determine initial justification effects
      //bool bStartingNewLine = true;
      //bool bBreakAtSpace = false;
      int pos = 0;
      int lpos = 0;
      int iLastSpace = -1;
      int iLastSpaceInLine = -1;
      string szLine = "";
      strText = strText.Replace("\r", " ");
      strText.Trim();
      while (pos < strText.Length)
      {
        // Get the current letter in the string
        char letter = strText[pos];

        // Handle the newline character
        if (letter == '\n')
        {
          if (szLine.Length > 0 || _listItems.Count > 0)
          {
            wrappedLines.Add(szLine);
          }
          iLastSpace = -1;
          iLastSpaceInLine = -1;
          lpos = 0;
          szLine = "";
        }
        else
        {
          if (letter == ' ')
          {
            iLastSpace = pos;
            iLastSpaceInLine = lpos;
          }

          if (lpos < 0 || lpos > 1023)
          {
            //OutputDebugString("ERRROR\n");
          }
          szLine += letter;

          string wsTmp = szLine;
          cntl1.Label = wsTmp;
          if (cntl1.TextWidth > iMaxWidth)
          {
            if (iLastSpace > 0 && iLastSpaceInLine != lpos)
            {
              szLine = szLine.Substring(0, iLastSpaceInLine);
              pos = iLastSpace;
            }
            if (szLine.Length > 0 || _listItems.Count > 0)
            {
              wrappedLines.Add(szLine);
            }
            iLastSpaceInLine = -1;
            iLastSpace = -1;
            lpos = 0;
            szLine = "";
          }
          else
          {
            lpos++;
          }
        }
        pos++;
      }
      if (lpos > 0)
      {
        wrappedLines.Add(szLine);
      }
      cntl1.SafeDispose();
    }