本文整理汇总了C#中Sandbox.Graphics.GUI.MyGuiControlLabel.GetTextSize方法的典型用法代码示例。如果您正苦于以下问题:C# MyGuiControlLabel.GetTextSize方法的具体用法?C# MyGuiControlLabel.GetTextSize怎么用?C# MyGuiControlLabel.GetTextSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sandbox.Graphics.GUI.MyGuiControlLabel
的用法示例。
在下文中一共展示了MyGuiControlLabel.GetTextSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateChatPageControls
private void CreateChatPageControls(MyGuiControlTabPage chatPage)
{
chatPage.Name = "PageComms";
chatPage.TextEnum = MySpaceTexts.TerminalTab_Chat;
float left = -0.4625f;
float right = -left;
float top = -0.34f;
int rowCount = 11;
float width = 0.35f;
//defined based on row count
float height = 0;
float margin = 0.02f;
var playerLabel = new MyGuiControlLabel()
{
Position = new Vector2(left, top),
Name = "PlayerLabel",
OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
Text = MyTexts.GetString(MyCommonTexts.ScreenCaptionPlayers)
};
chatPage.Controls.Add(playerLabel);
top += playerLabel.GetTextSize().Y + 0.01f;
var playerList = new MyGuiControlListbox()
{
Position = new Vector2(left, top),
Size = new Vector2(width, 0f),
Name = "PlayerListbox",
OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
VisibleRowsCount = rowCount
};
chatPage.Controls.Add(playerList);
height = playerList.ItemSize.Y * rowCount;
top += height + margin;
rowCount = 4;
var factionLabel = new MyGuiControlLabel()
{
Position = new Vector2(left, top),
Name = "PlayerLabel",
OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
Text = MyTexts.GetString(MyCommonTexts.Factions)
};
chatPage.Controls.Add(factionLabel);
top += playerLabel.GetTextSize().Y + 0.01f;
var factionsList = new MyGuiControlListbox()
{
Position = new Vector2(left, top),
Size = new Vector2(width, 0f),
Name = "FactionListbox",
OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
VisibleRowsCount = rowCount
};
chatPage.Controls.Add(factionsList);
top = -0.34f;
width = 0.6f;
height = 0.515f;
margin = 0.038f;
var chatboxPanel = new MyGuiControlPanel()
{
OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP,
Position = new Vector2(right, top),
Size = new Vector2(width, height),
BackgroundTexture = MyGuiConstants.TEXTURE_RECTANGLE_NEUTRAL,
};
chatPage.Controls.Add(chatboxPanel);
var chatHistory = new MyGuiControlMultilineText(
position: new Vector2(right, top + 0.005f),
size: new Vector2(width - 0.01f, height - 0.01f),
backgroundColor: null,
font: MyFontEnum.Blue,
textScale: 0.95f,
textAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
contents: null);
chatHistory.Name = "ChatHistory";
chatHistory.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP;
chatHistory.TextBoxAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
chatPage.Controls.Add(chatHistory);
top += height + margin;
height = 0.05f;
var chatbox = new MyGuiControlTextbox()
{
Position = new Vector2(right, top),
Size = new Vector2(width, height),
Name = "Chatbox",
OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER
//.........这里部分代码省略.........