本文整理汇总了C#中Control.SetPosition方法的典型用法代码示例。如果您正苦于以下问题:C# Control.SetPosition方法的具体用法?C# Control.SetPosition怎么用?C# Control.SetPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Control
的用法示例。
在下文中一共展示了Control.SetPosition方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NewControl
private void NewControl()
{
if ( m_root != null )
{
if ( !EditorUtility.DisplayDialog( "Confirm New Control", "Are you sure you would like to create a new control? Current layout will be discarded!", "Ok", "Cancel" ) )
{
return;
}
foreach( Control child in m_root.Children )
{
RemoveChildControl( child );
}
m_workarea.RemoveChild( m_root );
RemoveHierarchyEntry( m_root );
}
m_root = new Control();
m_root.SetSize( 100.0f, 100.0f );
m_root.SetPosition( m_workarea.Size.x / 2.0f - 50.0f, m_workarea.Size.y / 2.0f - 50.0f );
m_root.AddDecorator( new BackgroundColor( Color.gray ) );
m_workarea.AddChild( m_root );
SetSelectedControl( m_root );
SetInspectorTarget( m_root );
CreateHierarchyEntry( m_root, 0 );
}
示例2: OnInitialize
protected override void OnInitialize()
{
m_generator = new UFormsCodeGenerator();
title = "Control Designer";
m_menu = new DesignerTopMenu();
m_menu.SetSize( 100.0f, CONTROL_DISPLAY_HEIGHT, Control.MetricsUnits.Percentage, Control.MetricsUnits.Pixel );
m_menu.MenuOptionSelected += HandleMenuOptionSelected;
AddChild( m_menu );
m_inspectorFields = new Dictionary<object, PropertyInfo>();
m_hierarchyItems = new Dictionary<Control, HierarchyItem>();
m_inspector = new Control();
m_inspector.SetPosition( position.width - INSPECTOR_WIDTH , CONTROL_DISPLAY_HEIGHT + TOP_MENU_SPACING );
m_inspector.SetWidth( INSPECTOR_WIDTH );
m_inspector.SetMargin( 0.0f, 0.0f, SIDE_MARGIN, 0.0f );
m_inspector.AddDecorator( new StackContent( StackContent.StackMode.Vertical, StackContent.OverflowMode.Flow ) );
AddChild( m_inspector );
m_hierarchy = new Control();
m_hierarchy.SetPosition( 0.0f, CONTROL_DISPLAY_HEIGHT + TOP_MENU_SPACING );
m_hierarchy.SetWidth( HIERARCHY_WIDTH );
m_hierarchy.SetMargin( SIDE_MARGIN, 0.0f, 0.0f, 0.0f );
m_hierarchy.AddDecorator( new StackContent( StackContent.StackMode.Vertical, StackContent.OverflowMode.Flow ) );
AddChild( m_hierarchy );
m_workarea = new Control();
m_workarea.SetPosition( m_viewportOffset );
m_workarea.AddDecorator( new ClipContent() );
AddChild( m_workarea );
m_resizeHandle = new Control();
m_resizeHandle.SetSize( RESIZE_HANDLE_SIZE, RESIZE_HANDLE_SIZE );
m_resizeHandle.AddDecorator( new BackgroundColor( Color.blue ) );
m_resizeHandle.Visibility = Control.VisibilityMode.Hidden;
AddChild( m_resizeHandle );
SetSelectedControl( null );
SetInspectorTarget( null );
ShowToolbox();
}