当前位置: 首页>>代码示例>>C#>>正文


C# Control.SetPosition方法代码示例

本文整理汇总了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 );
        }
开发者ID:ChelseaLing,项目名称:UForms,代码行数:30,代码来源:Designer.cs

示例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();
        }
开发者ID:ChelseaLing,项目名称:UForms,代码行数:47,代码来源:Designer.cs


注:本文中的Control.SetPosition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。