本文整理汇总了C#中MediaPortal.GUI.Library.GUIImage.AllocResources方法的典型用法代码示例。如果您正苦于以下问题:C# GUIImage.AllocResources方法的具体用法?C# GUIImage.AllocResources怎么用?C# GUIImage.AllocResources使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MediaPortal.GUI.Library.GUIImage
的用法示例。
在下文中一共展示了GUIImage.AllocResources方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
{
//.........这里部分代码省略.........
示例2: RenderSingleChannel
//void SetProperties()
protected override void RenderSingleChannel(Channel channel)
{
string strLogo;
int chan = ChannelOffset;
for (int iChannel = 0; iChannel < _channelCount; iChannel++)
{
if (chan < _channelList.Count)
{
Channel tvChan = _channelList[chan].channel;
strLogo = GetChannelLogo(tvChan.DisplayName);
GUIButton3PartControl img = GetControl(iChannel + (int)Controls.IMG_CHAN1) as GUIButton3PartControl;
if (img != null)
{
if (_showChannelLogos)
{
img.TexutureIcon = strLogo;
}
img.Label1 = tvChan.DisplayName;
img.Data = tvChan;
img.IsVisible = true;
}
}
chan++;
}
GUILabelControl channelLabel = GetControl((int)Controls.SINGLE_CHANNEL_LABEL) as GUILabelControl;
GUIImage channelImage = GetControl((int)Controls.SINGLE_CHANNEL_IMAGE) as GUIImage;
strLogo = GetChannelLogo(channel.DisplayName);
if (channelImage == null)
{
if (strLogo.Length > 0)
{
channelImage = new GUIImage(GetID, (int)Controls.SINGLE_CHANNEL_IMAGE,
GetControl((int)Controls.LABEL_TIME1).XPosition,
GetControl((int)Controls.LABEL_TIME1).YPosition - 15,
40, 40, strLogo, Color.White);
channelImage.AllocResources();
GUIControl temp = (GUIControl)channelImage;
Add(ref temp);
}
}
else
{
channelImage.SetFileName(strLogo);
}
if (channelLabel == null)
{
channelLabel = new GUILabelControl(GetID, (int)Controls.SINGLE_CHANNEL_LABEL,
channelImage.XPosition + 44,
channelImage.YPosition + 10,
300, 40, "font16", channel.DisplayName, 4294967295, GUIControl.Alignment.Left,
GUIControl.VAlignment.Top,
true, 0, 0, 0xFF000000);
channelLabel.AllocResources();
GUIControl temp = channelLabel;
Add(ref temp);
}
setSingleChannelLabelVisibility(true);
channelLabel.Label = channel.DisplayName;
if (strLogo.Length > 0)
{
channelImage.SetFileName(strLogo);
}
if (channelLabel != null)
{
channelLabel.Label = channel.DisplayName;
}
if (_recalculateProgramOffset)
{
_programs = new List<Program>();
DateTime dtStart = DateTime.Now;
dtStart = dtStart.AddDays(-1);
DateTime dtEnd = dtStart.AddDays(30);
TvBusinessLayer layer = new TvBusinessLayer();
_programs = layer.GetPrograms(channel, dtStart, dtEnd);
_totalProgramCount = _programs.Count;
if (_totalProgramCount == 0)
{
_totalProgramCount = _channelCount;
}
_recalculateProgramOffset = false;
bool found = false;
for (int i = 0; i < _programs.Count; i++)
{
Program program = (Program)_programs[i];
if (program.StartTime <= _viewingTime && program.EndTime >= _viewingTime)
{
//.........这里部分代码省略.........
示例3: PlaneScene
public PlaneScene(VMR9Util util)
{
// Log.Info("PlaneScene: ctor()");
_textureAddress = 0;
_vmr9Util = util;
// Number of vertex buffers must be same as numer of segments in non-linear stretch
_vertexBuffers = new VertexBuffer[nlsSourcePartitioning.Length];
for (int i = 0; i < _vertexBuffers.Length; i++)
{
_vertexBuffers[i] = new VertexBuffer(typeof (CustomVertex.TransformedColoredTextured),
4,
GUIGraphicsContext.DX9Device,
0,
CustomVertex.TransformedColoredTextured.Format,
GUIGraphicsContext.GetTexturePoolType());
}
_blackImage = new GUIImage(0);
_blackImage.SetFileName("black.png");
_blackImage.AllocResources();
_cropSettings = new CropSettings();
}
示例4: Update
private void Update(bool selectCurrentShow)
{
lock (this)
{
if (GUIWindowManager.ActiveWindowEx != this.GetID)
{
return;
}
// sets button visible state
UpdateGroupButton();
_updateTimer = DateTime.Now;
GUISpinControl cntlDay = GetControl((int)Controls.SPINCONTROL_DAY) as GUISpinControl;
// Find first day in TVGuide and set spincontrol position
int iDay = CalcDays();
for (; iDay < 0; ++iDay)
{
_viewingTime = _viewingTime.AddDays(1.0);
}
for (; iDay >= MaxDaysInGuide; --iDay)
{
_viewingTime = _viewingTime.AddDays(-1.0);
}
cntlDay.Value = iDay;
int xpos, ypos;
GUIControl cntlPanel = GetControl((int)Controls.PANEL_BACKGROUND);
GUIImage cntlChannelImg = (GUIImage)GetControl((int)Controls.CHANNEL_IMAGE_TEMPLATE);
GUILabelControl cntlChannelLabel = (GUILabelControl)GetControl((int)Controls.CHANNEL_LABEL_TEMPLATE);
GUILabelControl labelTime = (GUILabelControl)GetControl((int)Controls.LABEL_TIME1);
GUIImage cntlHeaderBkgImg = (GUIImage)GetControl((int)Controls.IMG_TIME1);
GUIImage cntlChannelTemplate = (GUIImage)GetControl((int)Controls.CHANNEL_TEMPLATE);
_titleDarkTemplate = GetControl((int)Controls.LABEL_TITLE_DARK_TEMPLATE) as GUILabelControl;
_titleTemplate = GetControl((int)Controls.LABEL_TITLE_TEMPLATE) as GUILabelControl;
_genreDarkTemplate = GetControl((int)Controls.LABEL_GENRE_DARK_TEMPLATE) as GUILabelControl;
_genreTemplate = GetControl((int)Controls.LABEL_GENRE_TEMPLATE) as GUILabelControl;
_programPartialRecordTemplate = GetControl((int)Controls.BUTTON_PROGRAM_PARTIAL_RECORD) as GUIButton3PartControl;
_programRecordTemplate = GetControl((int)Controls.BUTTON_PROGRAM_RECORD) as GUIButton3PartControl;
_programNotifyTemplate = GetControl((int)Controls.BUTTON_PROGRAM_NOTIFY) as GUIButton3PartControl;
_programNotRunningTemplate = GetControl((int)Controls.BUTTON_PROGRAM_NOT_RUNNING) as GUIButton3PartControl;
_programRunningTemplate = GetControl((int)Controls.BUTTON_PROGRAM_RUNNING) as GUIButton3PartControl;
_showChannelLogos = cntlChannelImg != null;
if (_showChannelLogos)
{
cntlChannelImg.IsVisible = false;
}
cntlChannelLabel.IsVisible = false;
cntlHeaderBkgImg.IsVisible = false;
labelTime.IsVisible = false;
cntlChannelTemplate.IsVisible = false;
int iLabelWidth = (cntlPanel.XPosition + cntlPanel.Width - labelTime.XPosition) / 4;
// add labels for time blocks 1-4
int iHour, iMin;
iMin = _viewingTime.Minute;
_viewingTime = _viewingTime.AddMinutes(-iMin);
iMin = (iMin / _timePerBlock) * _timePerBlock;
_viewingTime = _viewingTime.AddMinutes(iMin);
DateTime dt = new DateTime();
dt = _viewingTime;
for (int iLabel = 0; iLabel < 4; iLabel++)
{
xpos = iLabel * iLabelWidth + labelTime.XPosition;
ypos = labelTime.YPosition;
GUIImage img = GetControl((int)Controls.IMG_TIME1 + iLabel) as GUIImage;
if (img == null)
{
img = new GUIImage(GetID, (int)Controls.IMG_TIME1 + iLabel, xpos, ypos, iLabelWidth - 4,
cntlHeaderBkgImg.RenderHeight, cntlHeaderBkgImg.FileName, 0x0);
img.AllocResources();
GUIControl cntl2 = (GUIControl)img;
Add(ref cntl2);
}
img.IsVisible = !_singleChannelView;
img.Width = iLabelWidth - 4;
img.Height = cntlHeaderBkgImg.RenderHeight;
img.SetFileName(cntlHeaderBkgImg.FileName);
img.SetPosition(xpos, ypos);
img.DoUpdate();
GUILabelControl label = GetControl((int)Controls.LABEL_TIME1 + iLabel) as GUILabelControl;
if (label == null)
{
label = new GUILabelControl(GetID, (int)Controls.LABEL_TIME1 + iLabel, xpos, ypos, iLabelWidth,
cntlHeaderBkgImg.RenderHeight, labelTime.FontName, String.Empty,
labelTime.TextColor, GuideBase.TimeAlignment, labelTime.TextVAlignment, false,
labelTime.ShadowAngle, labelTime.ShadowDistance, labelTime.ShadowColor);
label.AllocResources();
GUIControl cntl = (GUIControl)label;
this.Add(ref cntl);
//.........这里部分代码省略.........
示例5: RenderItem
//.........这里部分代码省略.........
_listLabels[iButton].TextColor = dwColor;
_listLabels[iButton].Label = pItem.Label;
_listLabels[iButton].AllowScrolling = false;
_listLabels[iButton].Render(timePassed);
}
}
// Set oversized value
int iOverSized = 0;
if (bFocus && Focus && _enableFocusZoom && _zoomXPixels == 0 && _zoomYPixels == 0)
{
iOverSized = (_thumbNailWidth + _thumbNailHeight) / THUMBNAIL_OVERSIZED_DIVIDER;
}
GUIImage pFocusImage = null;
if (pItem.HasThumbnail)
{
GUIImage pImage = pItem.Thumbnail;
pFocusImage = pImage;
if (null == pImage /*&& _sleeper==0 */&& !IsAnimating)
{
pImage = new GUIImage(0, 0, _xPositionThumbNail - iOverSized + dwPosX,
_yPositionThumbNail - iOverSized + dwPosY, _thumbNailWidth + 2 * iOverSized,
_thumbNailHeight + 2 * iOverSized, pItem.ThumbnailImage, 0x0);
if (pImage != null)
{
pImage.ParentControl = this;
pImage.KeepAspectRatio = _keepAspectRatio;
pImage.ImageAlignment = Alignment.ALIGN_CENTER;
pImage.ImageVAlignment = VAlignment.ALIGN_MIDDLE;
pImage.MaskFileName = _textureMask;
pImage.ZoomFromTop = !pItem.IsFolder && _zoom;
pImage.AllocResources();
pItem.Thumbnail = pImage;
pImage.SetPosition(_xPositionThumbNail - iOverSized + dwPosX, _yPositionThumbNail - iOverSized + dwPosY);
pImage.DimColor = DimColor;
if (bFocus || !Focus)
{
pImage.ColourDiffuse = 0xffffffff;
}
else
{
pImage.ColourDiffuse = Color.FromArgb(_unfocusedAlpha, Color.White).ToArgb();
}
if (bFocus && (_zoomXPixels != 0 || _zoomYPixels != 0))
{
pImage.Width = _textureWidth + _zoomXPixels;
pImage.Height = _textureHeight + _zoomYPixels;
pImage.SetPosition(dwPosX - (_zoomXPixels / 2), dwPosY - (_zoomYPixels / 2));
}
pImage.Render(timePassed);
_sleeper += SLEEP_FRAME_COUNT;
}
}
if (null != pImage)
{
if (pImage.TextureHeight == 0 && pImage.TextureWidth == 0)
{
pImage.SafeDispose();
pImage.AllocResources();
}
pImage.ZoomFromTop = !pItem.IsFolder && _zoom;
pImage.Width = _thumbNailWidth + 2 * iOverSized;
pImage.Height = _thumbNailHeight + 2 * iOverSized;
pImage.ImageAlignment = Alignment.ALIGN_CENTER;
示例6: RenderIcon
protected virtual void RenderIcon(float timePassed, int buttonNr, int x, int y, bool gotFocus)
{
GUIListItem pItem = _listItems[buttonNr + _offset];
if (pItem.HasIcon)
{
if (MediaPortal.Util.Utils.FileExistsInCache(pItem.ThumbnailImage))
{
pItem.IconImage = pItem.ThumbnailImage;
}
// show icon
GUIImage pImage = pItem.Icon;
if (null == pImage)
{
pImage = new GUIImage(0, 0, 0, 0, _imageWidth, _imageHeight, pItem.IconImage, 0x0)
{
ParentControl = this,
KeepAspectRatio = _keepAspectRatio
};
pImage.AllocResources();
pItem.Icon = pImage;
}
if (pImage.TextureHeight == 0 && pImage.TextureWidth == 0)
{
pImage.SafeDispose();
pImage = new GUIImage(0, 0, 0, 0, _imageWidth, _imageHeight, pItem.IconImage, 0x0)
{
ParentControl = this,
KeepAspectRatio = _keepAspectRatio
};
pImage.AllocResources();
pItem.Icon = pImage;
//pImage.AllocResources();
}
pImage.KeepAspectRatio = _keepAspectRatio;
pImage.Width = _imageWidth;
pImage.Height = _imageHeight;
pImage.SetPosition(x, y);
if (gotFocus || !Focus)
{
pImage.ColourDiffuse = 0xffffffff;
}
else
{
pImage.ColourDiffuse = Color.FromArgb(_unfocusedAlpha, Color.White).ToArgb();
}
if (!pItem.Selected && !gotFocus && _unfocusedAlphaApplyToAll)
{
pImage.ColourDiffuse = Color.FromArgb(_unfocusedAlpha, Color.White).ToArgb();
}
pImage.DimColor = DimColor;
pImage.Render(timePassed);
}
}
示例7: RenderPinIcon
protected virtual void RenderPinIcon(float timePassed, int buttonNr, int x, int y, bool gotFocus)
{
GUIListItem pItem = _listItems[buttonNr + _offset];
if (pItem.HasPinIcon)
{
GUIImage pinImage = pItem.PinIcon;
if (null == pinImage)
{
//pinImage = new GUIImage(0, 0, 0, 0, 0, 0, pItem.PinImage, 0x0);
pinImage = new GUIImage(0, 0, 0, 0, _widthPinIcon, _heightPinIcon, pItem.PinImage, 0x0)
{
ParentControl = this,
KeepAspectRatio = _keepAspectRatio
};
pinImage.AllocResources();
pItem.PinIcon = pinImage;
}
pinImage.KeepAspectRatio = _keepAspectRatio;
pinImage.Width = PinIconWidth;
pinImage.Height = PinIconHeight;
if (PinIconOffsetY < 0 || PinIconOffsetX < 0)
{
pinImage.SetPosition(x + (_width) - (pinImage.TextureWidth + pinImage.TextureWidth / 2),
y + (_height / 2) - (pinImage.TextureHeight / 2));
}
else
{
pinImage.SetPosition(x + PinIconOffsetX, y + PinIconOffsetY);
}
if (gotFocus || !Focus)
{
pinImage.ColourDiffuse = 0xffffffff;
}
else
{
pinImage.ColourDiffuse = Color.FromArgb(_unfocusedAlpha, Color.White).ToArgb();
}
if (!pItem.Selected && !gotFocus && _unfocusedAlphaApplyToAll)
{
pinImage.ColourDiffuse = Color.FromArgb(_unfocusedAlpha, Color.White).ToArgb();
}
pinImage.DimColor = DimColor;
pinImage.Render(timePassed);
}
}
示例8: RenderCardFront
/// <summary>
/// Draws the front of a single item of the cover flow.
/// </summary>
/// <param name="timePassed"></param>
/// <param name="index">The index of the card in the entire set.</param>
/// <param name="shouldFocus">True if the card should be in focus.</param>
private void RenderCardFront(float timePassed, int index, bool shouldFocus)
{
GUIListItem pItem = _listItems[index];
GUIImage pCard = null;
bool itemFocused = (shouldFocus == true);
uint currentTime = (uint)System.Windows.Media.Animation.AnimationTimer.TickCount;
if (pItem.HasThumbnail)
{
pCard = pItem.Thumbnail;
if (null == pCard && !IsAnimating)
{
pCard = new GUIImage(0, 0,
0, 0,
_cardWidth, _cardHeight,
pItem.ThumbnailImage, 0x0);
pCard.ParentControl = null; // We want to be able to treat each card as a control.
pCard.KeepAspectRatio = _keepAspectRatio;
pCard.ZoomFromTop = !pItem.IsFolder && _zoom;
pCard.ImageAlignment = _imageAlignment;
pCard.ImageVAlignment = _imageVAlignment;
pCard.FlipY = _flipY;
pCard.DiffuseFileName = _diffuseFilename;
pCard.MaskFileName = _maskFilename;
pCard.DimColor = DimColor;
pCard.AllocResources();
pItem.Thumbnail = pCard;
}
if (null != pCard)
{
if (pCard.TextureHeight == 0 && pCard.TextureWidth == 0)
{
pCard.SafeDispose();
pCard.AllocResources();
}
if (itemFocused)
{
pCard.ColourDiffuse = 0xffffffff;
pCard.Focus = true;
}
else
{
pCard.ColourDiffuse = Color.FromArgb(_unfocusedAlpha, Color.White).ToArgb();
pCard.Focus = false;
}
// Ensure our card is setup as we expect because other views (filmstrip) may have changed these values.
pCard.KeepAspectRatio = _keepAspectRatio;
pCard.ZoomFromTop = !pItem.IsFolder && _zoom;
pCard.ImageAlignment = _imageAlignment;
pCard.ImageVAlignment = _imageVAlignment;
pCard.FlipY = _flipY;
pCard.DiffuseFileName = _diffuseFilename;
pCard.MaskFileName = _maskFilename;
pCard.DimColor = DimColor;
pCard.Width = _cardWidth;
pCard.Height = _cardHeight;
pCard.UpdateVisibility();
pCard.Render(timePassed);
}
}
else if (pItem.HasIconBig)
{
pCard = pItem.IconBig;
if (null == pCard && !IsAnimating)
{
pCard = new GUIImage(0, 0,
0, 0,
_cardWidth, _cardHeight,
pItem.IconImageBig, 0x0);
pCard.ParentControl = null; // We want to be able to treat each card as a control.
pCard.KeepAspectRatio = _keepAspectRatio;
pCard.ZoomFromTop = !pItem.IsFolder && _zoom;
pCard.ImageAlignment = _imageAlignment;
pCard.ImageVAlignment = _imageVAlignment;
pCard.FlipY = _flipY;
pCard.DiffuseFileName = _diffuseFilename;
pCard.MaskFileName = _maskFilename;
pCard.DimColor = DimColor;
pCard.AllocResources();
pItem.IconBig = pCard;
}
if (null != pCard)
{
if (itemFocused)
{
pCard.ColourDiffuse = 0xffffffff;
//.........这里部分代码省略.........
示例9: AllocResources
public override void AllocResources()
{
_fontNamedKey = GUIFontManager.GetFont(_namedKeyFont);
_fontCharKey = GUIFontManager.GetFont(_charKeyFont);
_fontSearchText = GUIFontManager.GetFont(_inputTextFont);
labelBox = new GUIImage(GetID, 1, 0, 0, 10, 10, _labelBoxTexture, 1);
labelBox.AllocResources();
label = new GUILabelControl(GetID);
label.FontName = _labelFont;
label.SetShadow(_labelShadowAngle, _labelShadowDistance, _labelShadowColor);
label.AllocResources();
inputTextBox = new GUIImage(GetID, 1, 0, 0, 10, 10, _inputTextBoxTexture, 1);
inputTextBox.AllocResources();
inputText = new GUILabelControl(GetID);
inputText.FontName = _inputTextFont;
inputText.SetShadow(_inputTextShadowAngle, _inputTextShadowDistance, _inputTextShadowColor);
inputText.AllocResources();
inputTextCaret = new GUILabelControl(GetID);
inputTextCaret.FontName = _inputTextFont;
inputTextCaret.SetShadow(_inputTextShadowAngle, _inputTextShadowDistance, _inputTextShadowColor);
inputTextCaret.AllocResources();
base.AllocResources();
_isAllocated = true;
}
示例10: RenderGenreKey
protected void RenderGenreKey()
{
GUIImage imgGenreColor = (GUIImage)GetControl((int)Controls.GENRE_COLOR_KEY_PAIR);
GUIFadeLabel labelGenreName = (GUIFadeLabel)GetControl((int)Controls.GENRE_COLOR_KEY_PAIR + 1);
MpGenre genreObj = _mpGenres.Find(x => x.Enabled == true);
// Do not render the key if the template controls are not present or there are no enabled mp genres.
if (imgGenreColor == null || labelGenreName == null || genreObj == null)
{
return;
}
// Display the genre key.
var genreKeys = _genreColorsOnLater.Keys.ToList();
genreKeys.Sort();
int xpos, i = 0;
int xoffset = 0;
foreach (var genreName in genreKeys)
{
// If the genre is not enabled then skip it. This can occur if the user desires to have less than the maximum number of MP genres available.
genreObj = ((List<MpGenre>)_mpGenres).Find(x => x.Name.Equals(genreName));
if (!genreObj.Enabled)
{
continue;
}
xpos = imgGenreColor.XPosition + xoffset;
GUIImage img = GetControl((int)Controls.GENRE_COLOR_KEY_PAIR + (2 * i)) as GUIImage;
if (img == null)
{
img = new GUIImage(GetID, (int)Controls.GENRE_COLOR_KEY_PAIR + (2 * i), xpos, imgGenreColor.YPosition, imgGenreColor.Width,
imgGenreColor.Height, imgGenreColor.FileName, 0x0);
img.AllocResources();
GUIControl cntl = (GUIControl)img;
Add(ref cntl);
}
img.IsVisible = true;
img.ColourDiffuse = _genreColorsOnLater[genreName];
img.OverlayFileName = imgGenreColor.OverlayFileName;
img.SetPosition(xpos, imgGenreColor.YPosition);
img.DoUpdate();
GUIFadeLabel label = GetControl(((int)Controls.GENRE_COLOR_KEY_PAIR + 1) + (2 * i)) as GUIFadeLabel;
if (label == null)
{
label = new GUIFadeLabel(GetID, ((int)Controls.GENRE_COLOR_KEY_PAIR + 1) + (2 * i), 0, 0, labelGenreName.Width,
labelGenreName.Height, labelGenreName.FontName,
labelGenreName.TextColor, labelGenreName.TextAlignment, labelGenreName.TextVAlignment,
labelGenreName.ShadowAngle, labelGenreName.ShadowDistance, labelGenreName.ShadowColor,
string.Empty);
label.AllocResources();
GUIControl cntl = (GUIControl)label;
this.Add(ref cntl);
}
label.Label = genreName;
label.SetPosition(xpos + imgGenreColor.Width + 10, labelGenreName.YPosition);
label.ScrollStartDelay = labelGenreName.ScrollStartDelay;
label.IsVisible = true;
// Compute position of the next key.
int w = label.Width;
if (label.TextWidth < label.Width)
{
w = label.TextWidth;
}
xoffset += (int)(imgGenreColor.Width * 2.3 + w);
i++;
}
}
示例11: AllocResources
public override void AllocResources()
{
base.AllocResources();
m_imgFocus = new GUIImage(GetID, GetID * 10, _positionX, _positionY, this.Width, this.Height,
"icon_empty_focus.png",
0xFFFFFFFF);
m_imgFocus.AllocResources();
m_imgNoFocus = new GUIImage(GetID, GetID * 100, _positionX, _positionY, this.Width, this.Height,
"icon_empty_nofocus.png", 0xFFFFFFFF);
m_imgNoFocus.AllocResources();
for (int i = 0; i < 9; i++)
{
m_imgOverlay[i] = new GUIImage(GetID, GetID * 1000 + i, _positionX, _positionY, this.Width, this.Height,
string.Format("icon_numberplace_overlay_{0}.png", i + 1), 0xFFFFFFFF);
m_imgOverlay[i].AllocResources();
}
m_label = new GUILabelControl(GetID, GetID * 1000, _positionX, _positionY, this.Width, this.Height, this.FontName,
string.Empty, 0xFFFFFFFF, Alignment.ALIGN_CENTER, VAlignment.ALIGN_MIDDLE, false,
_shadowAngle, _shadowDistance, _shadowColor);
_colorOverlay = new GUIImage(GetID, GetID * 10, _positionX, _positionY, this.Width, this.Height,
"icon_numberplace_colouroverlay.png", 0xFFFFFFFF);
_colorOverlay.AllocResources();
}
示例12: RenderGenreKey
protected void RenderGenreKey()
{
GUIImage imgGenreColor = (GUIImage)GetControl((int)Controls.GENRE_COLOR_KEY_PAIR);
GUIFadeLabel labelGenreName = (GUIFadeLabel)GetControl((int)Controls.GENRE_COLOR_KEY_PAIR + 1);
// Do not render the key if not required or the template controls are not present or are specified as not visible.
if (imgGenreColor == null || labelGenreName == null || !imgGenreColor.Visible)
{
return;
}
int xpos, i = 0;
int xoffset = 0;
var genreKeys = _genreColorsOnLater.Keys.ToList();
genreKeys.Sort();
// Loop through genre names.
foreach (var genreName in genreKeys)
{
xpos = imgGenreColor.XPosition + xoffset;
GUIImage img = GetControl((int)Controls.GENRE_COLOR_KEY_PAIR + (2 * i)) as GUIImage;
if (img == null)
{
img = new GUIImage(GetID, (int)Controls.GENRE_COLOR_KEY_PAIR + (2 * i), xpos, imgGenreColor.YPosition, imgGenreColor.Width,
imgGenreColor.Height, imgGenreColor.FileName, 0x0);
img.AllocResources();
GUIControl cntl = (GUIControl)img;
Add(ref cntl);
}
img.IsVisible = true;
img.ColourDiffuse = _genreColorsOnLater[genreName];
img.OverlayFileName = imgGenreColor.OverlayFileName;
img.SetPosition(xpos, imgGenreColor.YPosition);
img.DoUpdate();
GUIFadeLabel label = GetControl(((int)Controls.GENRE_COLOR_KEY_PAIR + 1) + (2 * i)) as GUIFadeLabel;
if (label == null)
{
label = new GUIFadeLabel(GetID, ((int)Controls.GENRE_COLOR_KEY_PAIR + 1) + (2 * i), 0, 0, labelGenreName.Width,
labelGenreName.Height, labelGenreName.FontName,
labelGenreName.TextColor, labelGenreName.TextAlignment, labelGenreName.TextVAlignment,
labelGenreName.ShadowAngle, labelGenreName.ShadowDistance, labelGenreName.ShadowColor,
string.Empty);
label.AllocResources();
GUIControl cntl = (GUIControl)label;
this.Add(ref cntl);
}
label.Label = genreName;
label.SetPosition(xpos + imgGenreColor.Width + 10, labelGenreName.YPosition);
label.ScrollStartDelay = labelGenreName.ScrollStartDelay;
label.IsVisible = true;
// Compute position of the next key.
int w = label.Width;
if (label.TextWidth < label.Width)
{
w = label.TextWidth;
}
xoffset += (int)(imgGenreColor.Width * 2.3 + w);
i++;
}
}