当前位置: 首页>>代码示例>>C#>>正文


C# Library.GUIFont类代码示例

本文整理汇总了C#中MediaPortal.GUI.Library.GUIFont的典型用法代码示例。如果您正苦于以下问题:C# GUIFont类的具体用法?C# GUIFont怎么用?C# GUIFont使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


GUIFont类属于MediaPortal.GUI.Library命名空间,在下文中一共展示了GUIFont类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FontRenderContext

    public FontRenderContext(GUIFont font, string t)
    {
      string text = font.GetRTLText(t);

      _outOfBounds = font.containsOutOfBoundsChar(text);

      _ptrStr = Marshal.StringToCoTaskMemUni(text);
    }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:8,代码来源:GUIFont.cs

示例2: FinalizeConstruction

    public override void FinalizeConstruction()
    {
      base.FinalizeConstruction();

      HasCamera = _hasCamera;
      Camera = new System.Drawing.Point(_cameraXPos, _cameraYPos);

      _font1 = GUIFontManager.GetFont(_fontName1);
      _font2 = GUIFontManager.GetFont(_fontName2);

      // Create the background.
      _imageBackground = LoadAnimationControl(_controlId, 0, _backgroundPositionX, _backgroundPositionY,
                                              _backgroundWidth, _backgroundHeight, _backgroundTextureName);
      _imageBackground.ParentControl = this;
      _imageBackground.DimColor = DimColor;

      // Create the foreground.
      _imageForeground = LoadAnimationControl(_controlId, 0, _foregroundPositionX, _foregroundPositionY,
                                              _foregroundWidth, _foregroundHeight, _foregroundTextureName);
      _imageForeground.ParentControl = this;
      _imageForeground.DimColor = DimColor;

      // Create a single focus frame for the card that is in focus.
      _frameFocus = LoadAnimationControl(0, 0,
                                         0, 0,
                                         _cardWidth, _cardHeight,
                                         _frameFocusName);
      _frameFocus.ParentControl = null;
      _frameFocus.DimColor = DimColor;
      _frameFocus.FlipY = _flipY;
      _frameFocus.DiffuseFileName = _diffuseFilename;
      _frameFocus.MaskFileName = _maskFilename;
      _frameFocus.AllocResources();

      // Create the card labels.
      int y = _positionY + _label1OffsetY;
      _label1 = new GUILabelControl(_controlId, 0,
                                    0, y,
                                    Width, 0,
                                    _fontName1, "", 0x0,
                                    Alignment.ALIGN_CENTER, VAlignment.ALIGN_TOP,
                                    false,
                                    _shadowAngle, _shadowDistance, _shadowColor);

      y = _positionY + _label2OffsetY;
      _label2 = new GUILabelControl(_controlId, 0,
                                    0, y,
                                    Width, 0,
                                    _fontName2, "", 0x0,
                                    Alignment.ALIGN_CENTER, VAlignment.ALIGN_TOP,
                                    false,
                                    _shadowAngle, _shadowDistance, _shadowColor);

      // Create the horizontal scrollbar.
      int scrollbarWidth = _scrollbarWidth;
      int scrollbarHeight = _scrollbarHeight;
      GUIGraphicsContext.ScaleHorizontal(ref scrollbarWidth);
      GUIGraphicsContext.ScaleVertical(ref scrollbarHeight);
      int scrollbarPosX = _positionX + (_width / 2) - (scrollbarWidth / 2);

      _horizontalScrollbar = new GUIHorizontalScrollbar(_controlId, 0,
                                                        scrollbarPosX, _positionY + _scrollbarOffsetY,
                                                        scrollbarWidth, scrollbarHeight,
                                                        _scrollbarBackgroundTextureName, _scrollbarLeftTextureName,
                                                        _scrollbarRightTextureName);
      _horizontalScrollbar.ParentControl = this;
      _horizontalScrollbar.DimColor = DimColor;

      // Create controls for the back of the selected card.  All of the controls are provided as a single subitem.      
      XmlDocument doc = new XmlDocument();

      if (SubItemCount > 0) // avoid exception when no SubItems are available
      {
        doc.LoadXml((string)GetSubItem(0));
        XmlNodeList nodeList = doc.DocumentElement.SelectNodes("/controls/*");
        IDictionary<string, string> defines = new Dictionary<string, string>(); // An empty set of defines.
        foreach (XmlNode node in nodeList)
        {
          try
          {
            GUIControl newControl = GUIControlFactory.Create(_windowId, node, defines, null);
            _cardBackControls.Add(newControl);
          }
          catch (Exception ex)
          {
            Log.Error("GUICoverFlow: Unable to load control. exception:{0}", ex.ToString());
          }
        }
      }
    }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:90,代码来源:GUICoverFlow.cs

示例3: FinalizeConstruction

    /// <summary> 
    /// This function is called after all of the XmlSkinnable fields have been filled
    /// with appropriate data.
    /// Use this to do any construction work other than simple data member assignments,
    /// for example, initializing new reference types, extra calculations, etc..
    /// </summary>
    public override sealed void FinalizeConstruction()
    {
      base.FinalizeConstruction();

      if (_fontName == null)
      {
        _fontName = string.Empty;
      }
      if (_fontName != "" && _fontName != "-")
      {
        _font = GUIFontManager.GetFont(_fontName);
      }

      GUILocalizeStrings.LocalizeLabel(ref _labelText);

      if (_labelText == null)
      {
        _labelText = string.Empty;
      }
      if (_labelText.IndexOf("#") >= 0)
      {
        _containsProperty = true;
      }
      CachedLabel();
    }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:31,代码来源:GUILabelControl.cs

示例4: AllocResources

    /// <summary>
    /// Allocate any direct3d sources
    /// </summary>
    public override void AllocResources()
    {
      _propertyHasChanged = true;

      if (_registeredForEvent == false)
      {
        GUIPropertyManager.OnPropertyChanged -= GUIPropertyManager_OnPropertyChanged;
        GUIPropertyManager.OnPropertyChanged += GUIPropertyManager_OnPropertyChanged;
        _registeredForEvent = true;
      }
      _font = GUIFontManager.GetFont(_fontName);
      Update();
      base.AllocResources();
    }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:17,代码来源:GUILabelControl.cs

示例5: FinalizeConstruction

    public override void FinalizeConstruction()
    {
      base.FinalizeConstruction();
      _lowItemHeight = _itemHeight;
      _lowItemWidth = _itemWidth;
      _lowTextureWidth = _textureWidth;
      _lowTextureHeight = _textureHeight;

      _controlUpDown = new GUISpinControl(GetID, 0, _spinControlPositionX, _spinControlPositionY,
                                          _spinControlWidth, _spinControlHeight,
                                          _upTextureName, _downTextureName, _upTextureNameFocus, _downTextureNameFocus,
                                          _fontName, _spinControlColor,
                                          GUISpinControl.SpinType.SPIN_CONTROL_TYPE_INT,
                                          _spinControlAlignment);
      _controlUpDown.ParentControl = this;
      _controlUpDown.DimColor = DimColor;

      int xpos = 5 + _positionX + _width;
      if (xpos + 15 > GUIGraphicsContext.Width)
      {
        xpos = GUIGraphicsContext.Width - 15;
      }
      _verticalScrollBar = new GUIVerticalScrollbar(_controlId, 0,
                                                    5 + _positionX + _width + _scrollbarXOff, _positionY,
                                                    _scrollbarWidth, _height,
                                                    _scrollbarBackGroundTextureName, _scrollbarTopTextureName,
                                                    _scrollbarBottomTextureName);
      _verticalScrollBar.ParentControl = this;
      _verticalScrollBar.SendNotifies = false;
      _verticalScrollBar.DimColor = DimColor;
      _font = GUIFontManager.GetFont(_fontName);
      SetTextureDimensions(_textureWidth, _textureHeight);
      SetThumbDimensionsLow(_xPositionThumbNail, _yPositionThumbNail, _thumbNailWidth, _thumbNailHeight);

      _frameNoFocusControl = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _itemWidth,
                                                  _itemHeight,
                                                  _frameNoFocusName);
      _frameNoFocusControl.ParentControl = this;
      _frameNoFocusControl.DimColor = DimColor;
      _frameNoFocusControl.MaskFileName = _frameNoFocusMask;
      _frameNoFocusControl.SetAnimations(_allThumbAnimations);


      _frameFocusControl = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _itemWidth,
                                                _itemHeight,
                                                _frameFocusName);
      _frameFocusControl.ParentControl = this;
      _frameFocusControl.DimColor = DimColor;
      _frameFocusControl.MaskFileName = _frameFocusMask;
      _frameFocusControl.SetAnimations(_allThumbAnimations);

      using (Settings xmlreader = new MPSettings())
      {
        _loopDelay = xmlreader.GetValueAsInt("gui", "listLoopDelay", 100);
      }
    }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:56,代码来源:GUIThumbnailPanel.cs

示例6: AllocResources

    public override void AllocResources()
    {
      _sleeper = 0;
      _font = GUIFontManager.GetFont(_fontName);
      base.AllocResources();
      _controlUpDown.AllocResources();
      _controlUpDown.DimColor = DimColor;
      _verticalScrollBar.AllocResources();
      _verticalScrollBar.DimColor = DimColor;

      if (ThumbAnimations == null || ThumbAnimations.Count < 1)
        _allThumbAnimations.Add(new VisualEffect());
      else
        _allThumbAnimations.AddRange(ThumbAnimations);

      if (_showFrame)
      {
        _frameFocusControl.AllocResources();
        _frameNoFocusControl.AllocResources();
        _frameFocusControl.DimColor = DimColor;
        _frameNoFocusControl.DimColor = DimColor;

        _frameFocusControl.SetAnimations(_allThumbAnimations);
        _frameNoFocusControl.SetAnimations(_allThumbAnimations);
      }

      Calculate();
    }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:28,代码来源:GUIThumbnailPanel.cs

示例7: AllocResources

 /// <summary>
 /// Allocates the control its DirectX resources.
 /// </summary>
 public override void AllocResources()
 {
   base.AllocResources();
   _imageCheckMarkFocused.AllocResources();
   _imageCheckMarkNonFocused.AllocResources();
   _font = GUIFontManager.GetFont(_fontName);
 }
开发者ID:sanyaade-embedded-systems,项目名称:MediaPortal-1,代码行数:10,代码来源:GUICheckMarkControl.cs

示例8: AllocResources

 /// <summary>
 /// Allocates the control its DirectX resources.
 /// </summary>
 public override void AllocResources()
 {
   _font = GUIFontManager.GetFont(_fontName);
 }
开发者ID:akhilgt,项目名称:MediaPortal-1,代码行数:7,代码来源:GUIFadeLabel.cs

示例9: FinalizeConstruction

    /// <summary> 
    /// This function is called after all of the XmlSkinnable fields have been filled
    /// with appropriate data.
    /// Use this to do any construction work other than simple data member assignments,
    /// for example, initializing new reference types, extra calculations, etc..
    /// </summary>
    public override sealed void FinalizeConstruction()
    {
      base.FinalizeConstruction();
      GUILocalizeStrings.LocalizeLabel(ref _label);

      // The labelTail is used to fill the backend of a scrolling label for both wrapping and non-wrapping labels
      // The wrapString is the text that joins the back to the front of a wrapping label (not used if the label should not wrap).
      if (_userWrapString.Length > 0)
      {
        _labelTail = "" + _userWrapString[_userWrapString.Length - 1];
        _wrapString = _userWrapString.Substring(0, _userWrapString.Length - 1);
      }

      _labelControl = new GUILabelControl(_parentControlId, 0, _positionX, _positionY, _width, _height, _fontName,
                                          _label, _textColor, _textAlignment, _textVAlignment, false,
                                          _shadowAngle, _shadowDistance, _shadowColor)
                        {
                          CacheFont = false,
                          ParentControl = this
                        };
      _labelControl.SetAnimations(Animations);
      if (_fontName != "" && _fontName != "-")
      {
        _font = GUIFontManager.GetFont(_fontName);
      }
      if (_label.IndexOf("#", System.StringComparison.Ordinal) >= 0)
      {
        _containsProperty = true;
      }
    }
开发者ID:akhilgt,项目名称:MediaPortal-1,代码行数:36,代码来源:GUIFadeLabel.cs

示例10: AllocResources

    /// <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;
      _imageBackground.AllocResources();

      _imageLeft.AllocResources();
      _imageLeftFocus.AllocResources();

      _imageRight.AllocResources();
      _imageRightFocus.AllocResources();

      _font = GUIFontManager.GetFont(_fontName);

      PositionLeftAndRightImages();

      _labelControl.AllocResources();
    }
开发者ID:nio22,项目名称:MediaPortal-1,代码行数:25,代码来源:GUISelectButtonControl.cs

示例11: FinalizeConstruction

    public override void FinalizeConstruction()
    {
      base.FinalizeConstruction();
      int x1 = 16;
      int y1 = 16;
      GUIGraphicsContext.ScalePosToScreenResolution(ref x1, ref y1);
      _imageFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height,
                                           _textureFocusName);
      _imageFocused.ParentControl = this;
      _imageFocused.DimColor = DimColor;

      _imageNonFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height,
                                              _textureNoFocusName);
      _imageNonFocused.ParentControl = this;
      _imageNonFocused.DimColor = DimColor;

      _imageBackground = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height,
                                              _backgroundTextureName);
      _imageBackground.ParentControl = this;
      _imageBackground.DimColor = DimColor;

      _imageLeft = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _leftTextureWidth, _leftTextureHeight, _leftTextureName);
      _imageLeft.DimColor = DimColor;
      _imageLeft.ParentControl = this;

      _imageLeftFocus = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _leftTextureFocusWidth, _leftTextureFocusHeight,
                                             _leftFocusName);
      _imageLeftFocus.ParentControl = this;
      _imageLeftFocus.DimColor = DimColor;

      _imageRight = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _rightTextureWidth, _rightTextureHeight, _rightTextureName);
      _imageRight.ParentControl = this;
      _imageRight.DimColor = DimColor;

      _imageRightFocus = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _rightTextureFocusWidth, _rightTextureFocusHeight,
                                              _rightFocusName);
      _imageRightFocus.ParentControl = this;
      _imageRightFocus.DimColor = DimColor;

      if (_fontName != "" && _fontName != "-")
      {
        _font = GUIFontManager.GetFont(_fontName);
      }
      GUILocalizeStrings.LocalizeLabel(ref _label);
      _imageFocused.Filtering = false;
      _imageNonFocused.Filtering = false;
      _imageBackground.Filtering = false;
      _imageLeft.Filtering = false;
      _imageLeftFocus.Filtering = false;
      _imageRight.Filtering = false;
      _imageRightFocus.Filtering = false;
      _labelControl = new GUILabelControl(_parentControlId);
      _labelControl.CacheFont = true;
      _labelControl.ParentControl = this;
      _labelControl.SetShadow(_shadowAngle, _shadowDistance, _shadowColor);
    }
开发者ID:nio22,项目名称:MediaPortal-1,代码行数:56,代码来源:GUISelectButtonControl.cs

示例12: LoadFonts

    /// <summary>
    /// Loads the fonts from a file.
    /// </summary>
    /// <param name="strFilename">The filename from where the fonts are loaded.</param>
    /// <returns>true if loaded else false</returns>
    public static bool LoadFonts(string strFilename)
    {
      // Clear current set of fonts
      Dispose();
      lock (Renderlock)
      {
        int counter = 0;
        Log.Info("  Load fonts from {0}", strFilename);
        _listFonts.DisposeAndClear();

        // Load the debug font
        GUIFont fontDebug = new GUIFont("debug", "Arial", 12);
        fontDebug.ID = counter++;
        fontDebug.Load();
        _listFonts.Add(fontDebug);

        try
        {
          // Load the XML document
          XmlDocument doc = new XmlDocument();
          doc.Load(strFilename);
          // Check the root element
          if (doc.DocumentElement == null)
          {
            return false;
          }
          string strRoot = doc.DocumentElement.Name;
          if (strRoot != "fonts")
          {
            return false;
          }
          // Select the list of fonts
          XmlNodeList list = doc.DocumentElement.SelectNodes("/fonts/font");
          foreach (XmlNode node in list)
          {
            XmlNode nodeStart = node.SelectSingleNodeFast("startchar");
            XmlNode nodeEnd = node.SelectSingleNodeFast("endchar");
            XmlNode nodeName = node.SelectSingleNodeFast("name");
            XmlNode nodeFileName = node.SelectSingleNodeFast("filename");
            XmlNode nodeHeight = node.SelectSingleNodeFast("height");
            XmlNode nodeBold = node.SelectSingleNodeFast("bold");
            XmlNode nodeItalics = node.SelectSingleNodeFast("italic");
            if (nodeHeight != null && nodeName != null && nodeFileName != null)
            {
              bool bold = false;
              bool italic = false;
              if (nodeBold != null && nodeBold.InnerText != null && nodeBold.InnerText.Equals("yes"))
              {
                bold = true;
              }
              if (nodeItalics != null && nodeItalics.InnerText != null && nodeItalics.InnerText.Equals("yes"))
              {
                italic = true;
              }
              string strName = nodeName.InnerText;
              string strFileName = nodeFileName.InnerText;
              int iHeight = Int32.Parse(nodeHeight.InnerText);

              // height is based on 720x576
              float fPercent = (((float)GUIGraphicsContext.Height) * GUIGraphicsContext.ZoomVertical) / 576.0f;
              fPercent *= iHeight;
              iHeight = (int)fPercent;
              FontStyle style = new FontStyle();
              style = FontStyle.Regular;
              if (bold)
              {
                style |= FontStyle.Bold;
              }
              if (italic)
              {
                style |= FontStyle.Italic;
              }
              GUIFont font = new GUIFont(strName, strFileName, iHeight, style);
              font.ID = counter++;

              // .NET's LocalisationProvider should give the correct amount of chars.
              if (nodeStart != null && nodeStart.InnerText != "" && nodeEnd != null && nodeEnd.InnerText != "")
              {
                int start = Int32.Parse(nodeStart.InnerText);
                int end = Int32.Parse(nodeEnd.InnerText);
                font.SetRange(start, end);
              }
              else
              {
                font.SetRange(0, GUIGraphicsContext.CharsInCharacterSet);
              }

              font.Load();
              _listFonts.Add(font);
            }
          }

          // Select the list of aliases
          XmlNodeList listAlias = doc.DocumentElement.SelectNodes("/fonts/alias");
          foreach (XmlNode node in listAlias)
//.........这里部分代码省略.........
开发者ID:disaster123,项目名称:MediaPortal-1,代码行数:101,代码来源:GUIFontManager.cs

示例13: SetLabel

 /// <summary>
 /// Set the text of the control. 
 /// </summary>
 /// <param name="strFontName">The font name.</param>
 /// <param name="strLabel">The text.</param>
 /// <param name="dwColor">The font color.</param>
 public void SetLabel(string strFontName, string strLabel, long dwColor)
 {
   if (strFontName == null || strLabel == null)
   {
     return;
   }
   _label = strLabel;
   _textColor = dwColor;
   _fontName = strFontName;
   _font = GUIFontManager.GetFont(_fontName);
 }
开发者ID:sanyaade-embedded-systems,项目名称:MediaPortal-1,代码行数:17,代码来源:GUICheckMarkControl.cs

示例14: FinalizeConstruction

    /// <summary>
    /// This method gets called when the control is created and all properties has been set
    /// It allows the control todo any initialization
    /// </summary>
    public override void FinalizeConstruction()
    {
      base.FinalizeConstruction();

      _imageCheckMarkFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY,
                                                    _checkMarkWidth, _checkMarkHeight, _checkMarkFocusTextureName);
      _imageCheckMarkFocused.ParentControl = this;
      _imageCheckMarkFocused.DimColor = DimColor;

      _imageCheckMarkNonFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY,
                                                       _checkMarkWidth, _checkMarkHeight, _checkMarkNoFocusTextureName);
      _imageCheckMarkNonFocused.ParentControl = this;
      _imageCheckMarkNonFocused.DimColor = DimColor;

      if (_fontName != "" && _fontName != "-")
      {
        _font = GUIFontManager.GetFont(_fontName);
      }

      GUILocalizeStrings.LocalizeLabel(ref _label);
    }
开发者ID:sanyaade-embedded-systems,项目名称:MediaPortal-1,代码行数:25,代码来源:GUICheckMarkControl.cs

示例15: Dispose

    public override void Dispose()
    {
      _font = null;
      _upDownControl.SafeDispose();

      _listItems.DisposeAndClear();
      _horizontalScrollbar.SafeDispose();
      _imageBackground.SafeDispose();
      _imageInfo.SafeDispose();

      _frameControl.DisposeAndClear();
      _frameFocusControl.DisposeAndClear();
      _imageFolder.DisposeAndClear();
      _imageFolderFocus.DisposeAndClear();
      _listLabels.DisposeAndClear();
      base.Dispose();
    }
开发者ID:MediaPortal,项目名称:MediaPortal-1,代码行数:17,代码来源:GUIFilmstripControl.cs


注:本文中的MediaPortal.GUI.Library.GUIFont类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。