本文整理匯總了C#中Text.SetStyleAuto方法的典型用法代碼示例。如果您正苦於以下問題:C# Text.SetStyleAuto方法的具體用法?C# Text.SetStyleAuto怎麽用?C# Text.SetStyleAuto使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Text
的用法示例。
在下文中一共展示了Text.SetStyleAuto方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: InitWindow
void InitWindow()
{
// Create the Window and add it to the UI's root node
window = new Window();
uiRoot.AddChild(window);
// Set Window size and layout settings
window.SetMinSize(384, 192);
window.SetLayout(LayoutMode.Vertical, 6, new IntRect(6, 6, 6, 6));
window.SetAlignment(HorizontalAlignment.Center, VerticalAlignment.Center);
window.Name = "Window";
// Create Window 'titlebar' container
UIElement titleBar = new UIElement();
titleBar.SetMinSize(0, 24);
titleBar.VerticalAlignment = VerticalAlignment.Top;
titleBar.LayoutMode = LayoutMode.Horizontal;
// Create the Window title Text
var windowTitle = new Text();
windowTitle.Name = "WindowTitle";
windowTitle.Value = "Hello GUI!";
// Create the Window's close button
Button buttonClose = new Button();
buttonClose.Name = "CloseButton";
// Add the controls to the title bar
titleBar.AddChild(windowTitle);
titleBar.AddChild(buttonClose);
// Add the title bar to the Window
window.AddChild(titleBar);
// Apply styles
window.SetStyleAuto(null);
windowTitle.SetStyleAuto(null);
buttonClose.SetStyle("CloseButton", null);
buttonClose.SubscribeToReleased(_ => Engine.Exit());
// Subscribe also to all UI mouse clicks just to see where we have clicked
UI.SubscribeToUIMouseClick(HandleControlClicked);
}