本文整理汇总了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);
}
示例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());
}
}
}
}
示例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();
}
示例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();
}
示例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);
}
}
示例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();
}
示例7: AllocResources
/// <summary>
/// Allocates the control its DirectX resources.
/// </summary>
public override void AllocResources()
{
base.AllocResources();
_imageCheckMarkFocused.AllocResources();
_imageCheckMarkNonFocused.AllocResources();
_font = GUIFontManager.GetFont(_fontName);
}
示例8: AllocResources
/// <summary>
/// Allocates the control its DirectX resources.
/// </summary>
public override void AllocResources()
{
_font = GUIFontManager.GetFont(_fontName);
}
示例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;
}
}
示例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();
}
示例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);
}
示例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)
//.........这里部分代码省略.........
示例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);
}
示例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);
}
示例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();
}