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


C# GUIImage.SetPosition方法代码示例

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


在下文中一共展示了GUIImage.SetPosition方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RenderItem

    /// <summary>
    /// Method to render a single item of the filmstrip
    /// </summary>
    /// <param name="bFocus">true if item shown be drawn focused, false for normal mode</param>
    /// <param name="dwPosX">x-coordinate of the item</param>
    /// <param name="dwPosY">y-coordinate of the item</param>
    /// <param name="pItem">item itself</param>
    private void RenderItem(int itemNumber, float timePassed, bool bFocus, int dwPosX, int dwPosY, GUIListItem pItem)
    {
      if (_font == null)
      {
        return;
      }
      if (pItem == null)
      {
        return;
      }
      if (dwPosY < 0)
      {
        return;
      }

      bool itemFocused = bFocus == true && Focus && _listType == GUIListControl.ListType.CONTROL_LIST;

      float fTextHeight = 0, fTextWidth = 0;
      _font.GetTextExtent("W", ref fTextWidth, ref fTextHeight);

      float fTextPosY = (float)dwPosY + (float)_textureHeight;

      TransformMatrix tm = null;
      long dwColor = _textColor;
      if (pItem.Selected)
      {
        dwColor = _selectedColor;
      }
      if (pItem.IsPlayed)
      {
        dwColor = _playedColor;
      }
      if (!bFocus && Focus)
      {
        dwColor = Color.FromArgb(_unfocusedAlpha, Color.FromArgb((int)dwColor)).ToArgb();
      }
      if (pItem.IsRemote)
      {
        dwColor = _remoteColor;
        if (pItem.IsDownloading)
        {
          dwColor = _downloadColor;
        }
      }
      if (pItem.IsBdDvdFolder)
      {
        dwColor = _bdDvdDirectoryColor;
      }
      if (!Focus)
      {
        dwColor &= DimColor;
      }

      //uint currentTime = (uint) (DXUtil.Timer(DirectXTimer.GetAbsoluteTime)*1000.0);
      uint currentTime = (uint)System.Windows.Media.Animation.AnimationTimer.TickCount;
      // Set oversized value
      int iOverSized = 0;

      if (itemFocused && _enableFocusZoom)
      {
        iOverSized = (_thumbNailWidth + _thumbNailHeight) / THUMBNAIL_OVERSIZED_DIVIDER;
      }
      GUIImage pImage = null;

      if (pItem.HasThumbnail)
      {
        pImage = pItem.Thumbnail;
        if (null == pImage && _sleeper == 0 && !IsAnimating)
        {
          pImage = new GUIImage(0, 0, _thumbNailPositionX - iOverSized + dwPosX,
                                _thumbNailPositionY - iOverSized + dwPosY, _thumbNailWidth + 2 * iOverSized,
                                _thumbNailHeight + 2 * iOverSized, pItem.ThumbnailImage, 0x0);
          pImage.ParentControl = this;
          pImage.KeepAspectRatio = _keepAspectRatio;
          pImage.ZoomFromTop = !pItem.IsFolder && _zoom;
          pImage.ImageAlignment = _imageAlignment;
          pImage.ImageVAlignment = _imageVAlignment;
          pImage.FlipX = _flipX;
          pImage.FlipY = _flipY;
          pImage.DiffuseFileName = _diffuseFileName;
          pImage.MaskFileName = _textureMask;
          pImage.SetAnimations(_allThumbAnimations);
          pImage.AllocResources();

          pItem.Thumbnail = pImage;
          pImage.SetPosition(_thumbNailPositionX - iOverSized + dwPosX, _thumbNailPositionY - iOverSized + dwPosY);
          pImage.DimColor = DimColor;
          _sleeper += SLEEP_FRAME_COUNT;
        }
        if (null != pImage)
        {
          if (pImage.TextureHeight == 0 && pImage.TextureWidth == 0)
          {
//.........这里部分代码省略.........
开发者ID:MediaPortal,项目名称:MediaPortal-1,代码行数:101,代码来源:GUIFilmstripControl.cs

示例2: RenderItem

    private void RenderItem(float timePassed, int iButton, bool bFocus, int dwPosX, int dwPosY, GUIListItem pItem,
                            bool buttonOnly)
    {
      if (_listButtons == null)
      {
        return;
      }
      if (iButton < 0 || iButton >= _listButtons.Count)
      {
        return;
      }
      GUIButtonControl btn = _listButtons[iButton];
      if (btn == null)
      {
        return;
      }

      btn.Width = _textureWidth;
      btn.Height = _textureHeight;

      bool clipping = false;
      if (bFocus && Focus)
      {
        Rectangle clipRect = new Rectangle();
        clipRect.X = _positionX - _zoomXPixels / 2;
        clipRect.Y = _positionY - _zoomYPixels / 2;
        clipRect.Width = (_columnCount * _itemWidth) + _zoomXPixels + (_zoomXPixels / 2);
        clipRect.Height = (_rowCount * _itemHeight) + _zoomYPixels + (_zoomYPixels / 2);
        if (clipRect.X < 0)
        {
          clipRect.X = 0;
        }
        if (clipRect.Y < 0)
        {
          clipRect.Y = 0;
        }
        GUIGraphicsContext.BeginClip(clipRect, false);
        clipping = true;
      }

      float fTextPosY = (float)dwPosY + (float)_textureHeight;

      long dwColor = _textColor;
      if (pItem.Selected)
      {
        dwColor = _selectedColor;
      }
      if (pItem.IsPlayed)
      {
        dwColor = _playedColor;
      }
      if (!bFocus && Focus)
      {
        dwColor = Color.FromArgb(_unfocusedAlpha, Color.FromArgb((int)dwColor)).ToArgb();
      }

      if (pItem.IsRemote)
      {
        dwColor = _remoteColor;
        if (pItem.IsDownloading)
        {
          dwColor = _downloadColor;
        }
      }

      if (pItem.IsBdDvdFolder)
      {
        dwColor = _bdDvdDirectoryColor;
      }

      if (!Focus)
      {
        dwColor &= DimColor;
      }

      if (bFocus == true && Focus && m_iSelect == GUIListControl.ListType.CONTROL_LIST)
      {
        if (buttonOnly)
        {
          btn.ColourDiffuse = 0xffffffff;
          btn.Focus = true;
          btn.SetPosition(dwPosX, dwPosY);
          //if (true == _showTexture) btn.Render(timePassed);

          if (clipping)
          {
            GUIGraphicsContext.EndClip();
          }
          return;
        }
        if (fTextPosY >= _positionY && _renderFocusText)
        {
          _listLabels[iButton].XPosition = dwPosX + _textXOff;
          _listLabels[iButton].YPosition = (int)Math.Truncate(fTextPosY + _textYOff + _zoomYPixels);
          _listLabels[iButton].Width = _textureWidth;
          _listLabels[iButton].Height = _textureHeight;
          _listLabels[iButton].TextColor = dwColor;
          _listLabels[iButton].Label = pItem.Label;
          _listLabels[iButton].AllowScrolling = true;
          _listLabels[iButton].Render(timePassed);
//.........这里部分代码省略.........
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:101,代码来源:GUIThumbnailPanel.cs


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