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


C# Group.AddChild方法代码示例

本文整理汇总了C#中Group.AddChild方法的典型用法代码示例。如果您正苦于以下问题:C# Group.AddChild方法的具体用法?C# Group.AddChild怎么用?C# Group.AddChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Group的用法示例。


在下文中一共展示了Group.AddChild方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateChildren

    override protected void CreateChildren()
    {
        base.CreateChildren();

        #region Controls

        Toolbar toolbar = new Toolbar();
        AddChild(toolbar);

        Button btnAddRect = new Button
        {
            Text = "New button",
            Icon = ImageLoader.Instance.Load("Icons/shape_square_add"),
            SkinClass = typeof(ImageButtonSkin),
            FocusEnabled = false
        };
        btnAddRect.Click += delegate { AddButton(); };
        toolbar.AddContentChild(btnAddRect);

        Button btnAddText = new Button
        {
            Text = "New text",
            Icon = ImageLoader.Instance.Load("Icons/page_white_text"),
            SkinClass = typeof(ImageButtonSkin),
            FocusEnabled = false
        };
        btnAddText.Click += delegate { AddTextField(); };
        toolbar.AddContentChild(btnAddText);

        Button btnClear = new Button
        {
            Text = "Clear",
            Icon = ImageLoader.Instance.Load("Icons/cancel"),
            SkinClass = typeof(ImageButtonSkin),
            FocusEnabled = false
        };
        btnClear.Click += delegate
        {
            _viewport.RemoveAllChildren();
            _count = 1;
        };
        toolbar.AddContentChild(btnClear);

        #endregion

        #region Scroller

        Scroller scroller = new Scroller
        {
            SkinClass = typeof(ScrollerSkin2),
            PercentWidth = 100,
            PercentHeight = 100
        };
        //scroller.SetStyle("horizontalScrollPolicy", ScrollPolicy.On);
        //scroller.SetStyle("verticalScrollPolicy", ScrollPolicy.On);
        AddChild(scroller);

        _viewport = new Group
        {
            MouseEnabled = true,
            Layout = new AbsoluteLayout()
        };
        scroller.Viewport = _viewport;

        #endregion

        #region Default controls

        var button = new Button
        {
            X = 200,
            Y = 200,
            Width = 300,
            Height = 200,
            MinWidth = 200,
            MinHeight = 200,
            FocusEnabled = false,
            Text = "Resize me!",
            Tooltip = "Resizable Button"
        };
        button.Plugins.Add(new Resizable()/* { ShowOverlay = false }*/);
        _viewport.AddChild(button);

        var textArea = new TextArea
        {
            X = 600,
            Y = 400,
            Width = 300,
            Height = 200,
            MinWidth = 100,
            MinHeight = 100,
            Text = LoremIpsum,
            Tooltip = "Resizable TextArea",
            Optimized = true
        };
        textArea.Plugins.Add(new Resizable()/* { ShowOverlay = false }*/);
        _viewport.AddChild(textArea);

        #endregion
    }
开发者ID:groov0v,项目名称:edriven-gui,代码行数:100,代码来源:ResizableDemo.cs

示例2: CreateChildren

    override protected void CreateChildren()
    {
        base.CreateChildren();

        #region Controls

        Toolbar toolbar = new Toolbar();
        AddChild(toolbar);

        Button button = new Button
        {
            Text = "Add data",
            SkinClass = typeof(ImageButtonSkin),
            Icon = ImageLoader.Instance.Load("Icons/star"),
            AutoRepeat = true
        };
        button.ButtonDown += delegate
        {
            _dataProvider.AddItem("data " + _random.Next(1, 100));
        };
        toolbar.AddContentChild(button);

        #endregion

        #region Scroller

        Scroller scroller = new Scroller
        {
            SkinClass = typeof (ScrollerSkin2),
            PercentWidth = 100,
            PercentHeight = 100
        };
        //scroller.SetStyle("horizontalScrollPolicy", ScrollPolicy.On);
        //scroller.SetStyle("verticalScrollPolicy", ScrollPolicy.On);
        AddChild(scroller);

        Group viewport = new Group
        {
            MouseEnabled = true,
            Layout = new VerticalLayout
            {
                HorizontalAlign = HorizontalAlign.Left,
                PaddingLeft = 10,
                PaddingRight = 10,
                PaddingTop = 10,
                PaddingBottom = 10,
                Gap = 10
            }
        };
        scroller.Viewport = viewport;

        #endregion

        List<object> source = new List<object> { "Failure", "Teaches", "Success", "One", "Two", "Three", "Four", "Five", "Six" };

        _dataProvider = new ArrayList(source);

        HGroup hGroup = new HGroup { PercentHeight = 100 };
        viewport.AddChild(hGroup);

        var factory = new ItemRendererFactory<DefaultItemRenderer>();

        VGroup vGroup2 = new VGroup { PercentHeight = 100 };
        hGroup.AddChild(vGroup2);

        HGroup hGroup2 = new HGroup
        {
            PercentWidth = 100
        };
        vGroup2.AddChild(hGroup2);

        /* LISTS */

        #region List 1

        List list = new List
                        {
                            Id = "list1",
                            //Layout = new TileLayout { RequestedColumnCount = 4 },
                            Width = 200, Height = 200,
                            DataProvider = _dataProvider,
                            //ItemRenderer = new ItemRendererFactory <DefaultItemRenderer>(),
                            ItemRendererFunction = delegate
                                                        {
                                                            return factory;
                                                        }
                        };
        hGroup2.AddChild(list);

        #endregion

        #region List 2

        list = new List
                    {
                        Id = "list2",
                        //Layout = new TileLayout { RequestedColumnCount = 3 },
                        Width = 200, Height = 245,
                        DataProvider = _dataProvider,
                        //ItemRenderer = new ItemRendererFactory <DefaultItemRenderer>(),
//.........这里部分代码省略.........
开发者ID:groov0v,项目名称:edriven-gui,代码行数:101,代码来源:ListDemo.cs

示例3: CreateChildren

    override protected void CreateChildren()
    {
        base.CreateChildren();

        #region Controls

        Toolbar toolbar = new Toolbar();
        AddChild(toolbar);

        Button button = new Button
        {
            Text = "Add data",
            SkinClass = typeof(ImageButtonSkin),
            Icon = ImageLoader.Instance.Load("Icons/add"),
            AutoRepeat = true
        };
        button.ButtonDown += delegate
        {
            _dataProvider.AddItem("data " + _random.Next(1, 100));
        };
        toolbar.AddContentChild(button);

        #endregion

        #region Scroller

        Scroller scroller = new Scroller
        {
            SkinClass = typeof (ScrollerSkin2),
            PercentWidth = 100,
            PercentHeight = 100
        };
        //scroller.SetStyle("horizontalScrollPolicy", ScrollPolicy.On);
        //scroller.SetStyle("verticalScrollPolicy", ScrollPolicy.On);
        AddChild(scroller);

        Group viewport = new Group
        {
            MouseEnabled = true,
            Layout = new VerticalLayout
            {
                HorizontalAlign = HorizontalAlign.Left,
                PaddingLeft = 10,
                PaddingRight = 10,
                PaddingTop = 10,
                PaddingBottom = 10,
                Gap = 10
            }
        };
        scroller.Viewport = viewport;
        //AddChild(viewport);

        #endregion

        #region Data controls

        List<object> source = new List<object> {"Failure", "Teaches", "Success", "One", "Two", "Three", "Four", "Five", "Six"};

        _dataProvider = new ArrayList(source);

        var factory = new ItemRendererFactory<DefaultItemRenderer>();

        /* LISTS */

        #region HGroup

        HGroup hGroup1 = new HGroup
                    {
                        PaddingLeft = 10,
                        PaddingRight = 10,
                        PaddingTop = 10,
                        PaddingBottom = 10,
                        Gap = 20
                    };

        //hbox.SetStyle("showBackground", true);
        //hbox.SetStyle("backgroundColor", RgbColor.FromHex(0x004CFF).ToColor());
        viewport.AddChild(hGroup1);

        #endregion

        HGroup hGroup = new HGroup();
        viewport.AddChild(hGroup);

        /* DATA GROUPS */

        #region Data group 1

        hGroup1 = new HGroup
        {
            PaddingLeft = 10,
            PaddingRight = 10,
            PaddingTop = 10,
            PaddingBottom = 10,
            Gap = 50
        };
        hGroup.AddChild(hGroup1);

        DataGroup dataGroup = new DataGroup
        {
//.........这里部分代码省略.........
开发者ID:groov0v,项目名称:edriven-gui,代码行数:101,代码来源:DataGroupDemo.cs

示例4: CreateChildren

    override protected void CreateChildren()
    {
        base.CreateChildren();

        #region Top label

        Label label = new TitleLabel { HorizontalCenter = 0, Top = 20, StyleName = "title" };
        AddChild(label);

        new TextRotator
        {
            Delay = 5, // 5 seconds delay
            Lines = new[]
            {
                "Form Demo 2",
                "Created with eDriven.Gui"/*,
                "Author: Danko Kozar"*/
            },
            Callback = delegate(string line) { label.Text = line; }
        }
        .Start();

        #endregion

        #region Scroller

        Scroller scroller = new Scroller
        {
            SkinClass = typeof(ScrollerSkin2),
            Left = 0,
            Right = 0,
            Top = 100,
            Bottom = 0
        };
        //scroller.SetStyle("horizontalScrollPolicy", ScrollPolicy.On);
        //scroller.SetStyle("verticalScrollPolicy", ScrollPolicy.On);
        AddChild(scroller);

        Group viewport = new Group
        {
            MouseEnabled = true,
            Layout = new VerticalLayout
            {
                HorizontalAlign = HorizontalAlign.Center,
                VerticalAlign = VerticalAlign.Middle,
                PaddingLeft = 10,
                PaddingRight = 10,
                PaddingTop = 0,
                PaddingBottom = 10,
                Gap = 10
            }
        };
        scroller.Viewport = viewport;

        #endregion

        Panel panel = new Panel
        {
            Title = "Form Demo 2",
            Icon = Resources.Load<Texture>("Icons/star"),
            SkinClass = typeof(PanelSkin2),
            MaxHeight = 800,
            //Height = 600 // for getting a scrollbar
        };
        viewport.AddChild(panel);

        Group container = new Group { Left = 10, Right = 10, Top = 10, Bottom = 10 };
        panel.AddContentChild(container);

        Form form = new Form {PercentWidth = 100};
        container.AddContentChild(form);

        #region Form items

        List list = new List
        {
            PercentWidth = 100,
            RequireSelection = true,
            SelectedItem = "Sine",
            DataProvider = new ArrayList(new List<object>
                                               {
                                                   new ListItem("Back", "Back"),
                                                   new ListItem("Bounce", "Bounce"),
                                                   new ListItem("Circ", "Circ"),
                                                   new ListItem("Cubic", "Cubic"),
                                                   new ListItem("Elastic", "Elastic"),
                                                   new ListItem("Expo", "Expo"),
                                                   new ListItem("Linear", "Linear"),
                                                   new ListItem("Quad", "Quad"),
                                                   new ListItem("Quart", "Quart"),
                                                   new ListItem("Quint", "Quint"),
                                                   new ListItem("Sine", "Sine")
                                               })
        };
        form.AddField("list", "List:", list);

        DropDownList dropDown = new DropDownList
        {
            PercentWidth = 100,
            DataProvider = new ArrayList(new List<object>
//.........这里部分代码省略.........
开发者ID:groov0v,项目名称:edriven-gui,代码行数:101,代码来源:FormDemo2.cs

示例5: OnEnable

    /*void Awake()
    {
        Debug.Log("CreateChildren");
    }

    void OnEnable()
    {
        Debug.Log("OnEnable");
    }*/

    override protected void CreateChildren()
    {
        base.CreateChildren();

        #region Scroller

        Scroller scroller = new Scroller
        {
            SkinClass = typeof(ScrollerSkin2),
            Left = 0,
            Right = 0,
            Top = 0,
            Bottom = 0,
        };
        //scroller.SetStyle("horizontalScrollPolicy", ScrollPolicy.On);
        //scroller.SetStyle("verticalScrollPolicy", ScrollPolicy.On);
        AddChild(scroller);

        Group viewport = new Group
        {
            Layout = new VerticalLayout
            {
                HorizontalAlign = HorizontalAlign.Left,
                PaddingLeft = 10,
                PaddingRight = 10,
                PaddingTop = 10,
                PaddingBottom = 10,
                Gap = 10
            }
        };
        scroller.Viewport = viewport;

        #endregion

        TitleLabel titleLabel = new TitleLabel
        {
            Text = "Slider Demo",
            StyleName = "title",
            Right = 20,
            Top = 20
        };
        AddChild(titleLabel);

        var labelStyles = new Hashtable
                              {
                                  {"labelStyle", BlueLabelStyle.Instance}
                              };

        AddChild(new Spacer { Height = 20 });

        #region Vertical sliders

        HGroup hbox = new HGroup
        {
            PercentWidth = 100,
            PercentHeight = 100,
            Gap = 10
        };
        viewport.AddChild(hbox);

        WrapVBox(hbox, new Label {Text = "100% slider", Styles = labelStyles},
            new VSlider {PercentHeight = 100})
            .PercentHeight = 100;

        WrapVBox(hbox, new Label {Text = "400px slider", Styles = labelStyles},
            new VSlider { Width = 30, Height = 400, SkinClass = typeof(VSliderSkin2) });

        WrapVBox(hbox, new Label { Text = "400px slider, disabled", Styles = labelStyles },
            new VSlider { Width = 30, Height = 400, SkinClass = typeof (VSliderSkin2), Enabled = false });

        WrapVBox(hbox, new Label {Text = "50x400 slider", Styles = labelStyles},
            new VSlider {Width = 50, Height = 400, SkinClass = typeof (VSliderSkin2)});

        WrapVBox(hbox, new Label { Text = "80x400 slider", Styles = labelStyles },
            new VSlider { Width = 80, Height = 400, SkinClass = typeof(VSliderSkin3) });

        WrapVBox(hbox, new Label { Text = "80x100% slider", Styles = labelStyles },
            new VSlider { Width = 80, PercentHeight = 100, Maximum = 1000, Value = 500, SkinClass = typeof(VSliderSkin3) })
            .PercentHeight = 100;

        #endregion

        #region Horizontal sliders

        WrapHBox(viewport, new Label {Text = "100% slider", Styles = labelStyles},
            new HSlider {Id = "miki", Maximum = 400, PercentWidth = 100})
            .PercentWidth = 100;

        WrapHBox(viewport, new Label { Text = "400px slider", Styles = labelStyles },
            new HSlider { Width = 400, Maximum = 400, Height = 30, SkinClass = typeof(HSliderSkin2) });
//.........这里部分代码省略.........
开发者ID:groov0v,项目名称:edriven-gui,代码行数:101,代码来源:SliderDemo.cs

示例6: CreateButton

    private static void CreateButton(Group parent)
    {
        Button btn1 = new Button
        {
            Text = @"Click to mask me for 3 seconds :)",
            Icon = Resources.Load<Texture>("Icons/star_big"),
            SkinClass = typeof (ButtonSkin5),
            Left = 100,
            Top = 100,
            Width = 250,
            Height = 250,
            FocusEnabled = false
        };
        btn1.Click += new EventHandler(delegate
        {
            int count = 0;

            LoadingMask mask = new LoadingMask(btn1);
            
            Timer t = new Timer(1, 3) {TickOnStart = true};
            t.Tick += delegate
            {
                mask.SetMessage(string.Format("Masking... {0} seconds", count));
                count++;
            };
            t.Complete += delegate { mask.Unmask(); };
            t.Start();
        });
        parent.AddChild(btn1);
    }
开发者ID:groov0v,项目名称:edriven-gui,代码行数:30,代码来源:LoadingMaskDemo.cs

示例7: CreateChildren

    override protected void CreateChildren()
    {
        base.CreateChildren();

        /**
         * Note: this demo HAS the overall scroller, but the stage itself SEEMS not to scroll
         * That's because we pushed the scrolled 150 px from both right and bottom
         * so we could place additional scrollbars there.
         * */

        #region Scroller + viewport

        Scroller scroller = new Scroller
        {
            SkinClass = typeof (ScrollerSkin2),
            Left = 10,
            Right = 150,
            Top = 10,
            Bottom = 150
        };
        //scroller.SetStyle("horizontalScrollPolicy", ScrollPolicy.On);
        //scroller.SetStyle("verticalScrollPolicy", ScrollPolicy.On);
        AddChild(scroller);

        Group viewport = new Group();
        scroller.Viewport = viewport;

        #endregion
        
        #region Horizontal scrollers

        HGroup hGroup = new HGroup { Gap = 10 };
        viewport.AddChild(hGroup);

        VGroup hScrollers = new VGroup
                                {
                                    PercentWidth = 100,
                                    Gap = 10,
                                    Left = 10,
                                    Right = 150,
                                    Bottom = 10
                                };
        AddChild(hScrollers);

        HScrollBar hScroll = new HScrollBar
                                    {
                                        SkinClass = typeof(HScrollBarSkin3),
                                        PercentWidth = 100,
                                        Maximum = 600,
                                        Viewport = viewport,
                                        MouseWheelScrollsHorizontally = true
                                    };
        hScrollers.AddChild(hScroll);

        hScroll = new HScrollBar
                        {
                            SkinClass = typeof(HScrollBarSkin2),
                            PercentWidth = 100,
                            Maximum = 600,
                            Viewport = viewport,
                        };
        hScrollers.AddChild(hScroll);

        hScroll = new HScrollBar
                        {
                            PercentWidth = 100,
                            Maximum = 600,
                            Viewport = viewport,
                        };
        hScrollers.AddChild(hScroll);

        #endregion

        #region Vertical scrollers

        HGroup vScrollers = new HGroup
                                {
                                    PercentHeight = 100,
                                    Gap = 10,
                                    Right = 10,
                                    Top = 10,
                                    Bottom = 150
                                };
        AddChild(vScrollers);

        VScrollBar vScroll = new VScrollBar
                                    {
                                        SkinClass = typeof(VScrollBarSkin3), PercentHeight = 100, Maximum = 600,
                                        Viewport = viewport
                                    };
        vScrollers.AddChild(vScroll);

        vScroll = new VScrollBar
        {
            SkinClass = typeof(VScrollBarSkin2),
            PercentHeight = 100,
            Maximum = 600,
            Viewport = viewport
        };
        vScrollers.AddChild(vScroll);
//.........这里部分代码省略.........
开发者ID:groov0v,项目名称:edriven-gui,代码行数:101,代码来源:ViewportDemo.cs

示例8: CreateChildren

    override protected void CreateChildren()
    {
        base.CreateChildren();

        TitleLabel titleLabel = new TitleLabel
        {
            Text = "Scrollbar Demo",
            StyleName = "title",
            Right = 20,
            Top = 20
        };
        AddChild(titleLabel);

        #region Scroller

        Scroller scroller = new Scroller
        {
            SkinClass = typeof (ScrollerSkin2),
            Left = 0,
            Right = 0,
            Top = 0,
            Bottom = 0,
        };
        //scroller.SetStyle("horizontalScrollPolicy", ScrollPolicy.On);
        //scroller.SetStyle("verticalScrollPolicy", ScrollPolicy.On);
        AddChild(scroller);

        Group viewport = new Group
        {
            Layout = new VerticalLayout
            {
                HorizontalAlign = HorizontalAlign.Left,
                PaddingLeft = 10,
                PaddingRight = 10,
                PaddingTop = 10,
                PaddingBottom = 10,
                Gap = 10
            }
        };
        scroller.Viewport = viewport;

        #endregion

        #region Vertical scrollbars

        HGroup hGroup = new HGroup {Gap = 10, Id = "hbox2", PercentHeight = 100};
        viewport.AddChild(hGroup);

        VScrollBar s = new VScrollBar {PercentHeight = 100, Maximum = 300};
        s.Change += delegate(Event e)
        {
            Debug.Log("Change: " + e);
        };
        hGroup.AddChild(s);

        s = new VScrollBar {PercentHeight = 100, Maximum = 400, PageSize = 100};
        hGroup.AddChild(s);

        s = new VScrollBar {SkinClass = typeof (VScrollBarSkin2), PercentHeight = 100, Maximum = 1000, PageSize = 100};
        hGroup.AddChild(s);

        s = new VScrollBar {SkinClass = typeof (VScrollBarSkin2), Height = 400, Maximum = 400, PageSize = 100};
        hGroup.AddChild(s);

        s = new VScrollBar {SkinClass = typeof (VScrollBarSkin3), PercentHeight = 100, Maximum = 200, PageSize = 100};
        hGroup.AddChild(s);

        s = new VScrollBar {SkinClass = typeof (VScrollBarSkin3), Height = 400, Maximum = 300, PageSize = 100};
        hGroup.AddChild(s);

        #endregion

        #region Horizontal scrollbars

        Label label = new Label {Text = "Will change the skin on drag: "};
        viewport.AddChild(label);

        HScrollBar scrollBar1 = new HScrollBar {Width = 300, Maximum = 300, PageSize = 100};
        scrollBar1.Change += delegate(Event e)
        {
            scrollBar1.SkinClass = typeof (HScrollBarSkin3);
        };
        viewport.AddChild(scrollBar1);

        label = new Label {Text = "Will change the skin on drag: "};
        viewport.AddChild(label);

        _scrollbar2 = new HScrollBar {PercentWidth = 100, Maximum = 500, Value = 200, PageSize = 100};
        _scrollbar2.Change += delegate(Event e)
        {
            _scrollbar2.SkinClass = typeof (HScrollBarSkin3);
        };
        viewport.AddChild(_scrollbar2);

        HScrollBar scrollbar3 = new HScrollBar
        {
            SkinClass = typeof (HScrollBarSkin2),
            MinWidth = 600,
            Maximum = 1000,
            PageSize = 100
//.........这里部分代码省略.........
开发者ID:groov0v,项目名称:edriven-gui,代码行数:101,代码来源:ScrollbarDemo.cs

示例9: CreateChildren

    override protected void CreateChildren()
    {
        base.CreateChildren();

        #region Title

        Label label = new TitleLabel {HorizontalCenter = 0, Top = 20, StyleName = "title", Text = "Panel demo"};
        AddChild(label);

        #endregion

        #region Scroller

        Scroller scroller = new Scroller
        {
            SkinClass = typeof (ScrollerSkin2),
            Left = 0,
            Right = 0,
            Top = 0,
            Bottom = 0,
        };
        //scroller.SetStyle("horizontalScrollPolicy", ScrollPolicy.On);
        //scroller.SetStyle("verticalScrollPolicy", ScrollPolicy.On);
        AddChild(scroller);

        Group viewport = new Group();
        scroller.Viewport = viewport;

        #endregion

        #region HGroup

        HGroup hGroup = new HGroup {Gap = 10, HorizontalCenter = 0, VerticalCenter = 0};
        viewport.AddChild(hGroup);

        #endregion

        #region Panel 1

        Panel panel = new MyPanel
        {
            Width = 360,
            Height = 600,
            Icon = ImageLoader.Instance.Load("Icons/shape_square_add"),
            Title = "First panel",
            StyleName = "default"
        };
        hGroup.AddChild(panel);

        #endregion
        
        #region Panel 2

        panel = new MyPanel
        {
            //Width = 360,
            Height = 600,
            SkinClass = typeof(PanelSkin2),
            Icon = ImageLoader.Instance.Load("Icons/page_white_text"),
            Title = "Second panel"
        };
        hGroup.AddChild(panel);

        //// NOTE: propagation of styles to skin still not implemented
        //// So, this won't work: panel.SetStyle("headerLabelColor", 0xffff00);
        //// This is a temporary solution:
        //panel.CreationCompleteHandler += delegate
        //{
            //Debug.Log("panel.Skin: " + panel.Skin);
            //panel.Skin.SetStyle("headerLabelColor", Color.yellow);
        //};

        #endregion

        #region Panel 2 skin switch

        VGroup vGroup = new VGroup();
        vGroup.Plugins.Add(new TabManager { ArrowsEnabled = true, UpDownArrowsEnabled = true });
        hGroup.AddChild(vGroup);

        Button button = new Button { Text = "Skin 1", Icon = Resources.Load<Texture>("Icons/skin"), SkinClass = typeof(ImageButtonSkin), PercentWidth = 100 };
        button.Press += delegate
        {
            panel.SkinClass = typeof (PanelSkin);
            //((MyPanel)panel).CreateButtons();
        };
        vGroup.AddChild(button);

        button = new Button { Text = "Skin 2", Icon = Resources.Load<Texture>("Icons/skin"), SkinClass = typeof(ImageButtonSkin), PercentWidth = 100 };
        button.Press += delegate
        {
            panel.SkinClass = typeof (PanelSkin2);
        };
        vGroup.AddChild(button);

        button = new Button { Text = "Skin 3", Icon = Resources.Load<Texture>("Icons/skin"), SkinClass = typeof(ImageButtonSkin), PercentWidth = 100 };
        button.Press += delegate
        {
            panel.SkinClass = typeof (PanelSkin3);
        };
//.........这里部分代码省略.........
开发者ID:groov0v,项目名称:edriven-gui,代码行数:101,代码来源:PanelDemo.cs

示例10: CreateChildren

    protected override void CreateChildren()
    {
        base.CreateChildren();

        #region Heading

        TitleLabel button = new TitleLabel
        {
            StyleName = "title",
            HorizontalCenter = 0,
            Top = 20
        };

        AddChild(button);

        new TextRotator
        {
            Delay = 5, // 5 seconds delay
            Lines = new[]
                            {
                                "Drag and Drop Demo 2", 
                                "Created using eDriven.Gui",
                                //"Author: Danko Kozar",
                                "Drag items from the left panel (source)",
                                "Drop them to the right panel (destination)"
                            },
            Callback = delegate(string line) { button.Text = line; }
        }
            .Start();


        #endregion

        #region Box

        _box = new Group
                   {
                       HorizontalCenter = 0, VerticalCenter = 0,
                       Layout = new HorizontalLayout
                                    {
                                        HorizontalAlign = HorizontalAlign.Center,
                                        VerticalAlign = VerticalAlign.Top
                                    }
                   };

        // mandatory listeners
        AddEventListener(MouseEvent.MOUSE_DOWN, OnMouseDown); // mouse down
        AddEventListener(DragEvent.DRAG_ENTER, OnDragEnter); // drag enter
        AddEventListener(DragEvent.DRAG_DROP, OnDragDrop); // drag drop (on drop target)

        // optional listeners
        AddEventListener(DragEvent.DRAG_START, OnDragStart); // drag start(on drag initiator)
        AddEventListener(DragEvent.DRAG_EXIT, OnDragExit); // drag exit (on drop target)
        AddEventListener(DragEvent.DRAG_COMPLETE, OnDragComplete); // drag complete (on drag initiator)

        //_box.AddEventListener(MouseEvent.MOUSE_OVER, OnMouseOver);
        //_box.AddEventListener(MouseEvent.MOUSE_OUT, OnMouseOut);
        //_box.AddEventListener(MouseEvent.MOUSE_UP, OnMouseUp);

        AddChild(_box);

        #endregion

        #region Source

        _pnlSource = new Panel
                         {
                             Title = "Source",
                             Icon = Resources.Load<Texture>("Icons/star"),
                             //Width = 450,
                             //Height = 500,
                             MouseEnabled = true,
                             SkinClass = typeof(PanelSkin2),
                             Layout = new TileLayout
                             {
                                 Orientation = TileOrientation.Rows,
                                 HorizontalGap = 10,
                                 VerticalGap = 10,
                                 RowHeight = 128 + 20, // image = 128x128, padding = 10 + 10
                                 ColumnWidth = 128 + 20,
                                 RequestedRowCount = 3,
                                 RequestedColumnCount = 3
                             }
                         };
        _pnlSource.SetStyle("addedEffect", _panelShowEffect);

        _box.AddChild(_pnlSource);

        Button btnReset = new Button
        {
            Text = "Reset",
            SkinClass = typeof(ImageButtonSkin),
            Icon = ImageLoader.Instance.Load("Icons/arrow_refresh")
        };
        btnReset.Press += delegate { InitChildren(); };
        _pnlSource.ControlBarGroup.AddChild(btnReset);

        /*Label lbl = new Label { Text = "miki" };
        _pnlSource.ControlBarGroup.AddChild(lbl);*/

//.........这里部分代码省略.........
开发者ID:groov0v,项目名称:edriven-gui,代码行数:101,代码来源:DragDropDemo2.cs

示例11: CreateChildren

    override protected void CreateChildren()
    {
        base.CreateChildren();

        #region Scroller and viewport

        Scroller scroller = new Scroller
                                {
                                    SkinClass = typeof(ScrollerSkin2),
                                    Left = 0,
                                    Right = 0,
                                    Top = 0,
                                    Bottom = 0,
                                };
        AddChild(scroller);

        Group viewport = new Group
                                {
                                    Id = "viewport",
                                    Layout = new AbsoluteLayout()
                                };
        scroller.Viewport = viewport;

        Group g = new Group();
        viewport.AddChild(g);

        var image = new Image
        {
            Mode = ImageMode.Tiled,
            TilingAnchor = Anchor.BottomRight,
            Texture = (Texture)Resources.Load("stripes3"),
            Left = 10,
            Right = 10,
            Top = 10,
            Bottom = 10,
            Tooltip = "Original size"
        };
        g.AddChild(image);

        #endregion

        #region VGroup

        VGroup vGroup = new VGroup
                            {
                                Id = "vGroup",
                                PaddingLeft = 10,
                                PaddingRight = 10,
                                PaddingTop = 10,
                                PaddingBottom = 10,
                                Left = 10,
                                Right = 10,
                                Top = 10,
                                Bottom = 10,
                                Gap = 10
                            };
        g.AddChild(vGroup);

        #endregion

        #region Images

        var hgroup = new HGroup();
        vGroup.AddChild(hgroup);

        image = new Image
        {
            Texture = (Texture) Resources.Load("eDriven/Editor/Logo/logo"),
            ScaleMode = ImageScaleMode.OriginalSize
        };
        hgroup.AddChild(image);

        image = new Image
        {
            Width = 600,
            Height = 400,
            Texture = (Texture)Resources.Load("eDriven/Editor/Logo/logo"),
            ScaleMode = ImageScaleMode.OriginalSize
        };
        hgroup.AddChild(image);

        image = new Image
        {
            Width = 300,
            Height = 150,
            Texture = (Texture)Resources.Load("eDriven/Editor/Logo/logo"),
            ScaleMode = ImageScaleMode.OriginalSize
        };
        hgroup.AddChild(image);

        image = new Image
        {
            Width = 150,
            Height = 300,
            Texture = (Texture)Resources.Load("eDriven/Editor/Logo/logo"),
            ScaleMode = ImageScaleMode.OriginalSize
        };
        hgroup.AddChild(image);

        hgroup = new HGroup();
//.........这里部分代码省略.........
开发者ID:groov0v,项目名称:edriven-gui,代码行数:101,代码来源:ImageDemo.cs

示例12: CreateChildren

    override protected void CreateChildren()
    {
        base.CreateChildren();

        #region Controls

        Toolbar toolbar = new Toolbar();
        AddChild(toolbar);

        Button button = new Button
        {
            Text = "Add data",
            SkinClass = typeof(ImageButtonSkin),
            Icon = ImageLoader.Instance.Load("Icons/add"),
            AutoRepeat = true
        };
        button.ButtonDown += delegate
        {
            _dataProvider.AddItem("data " + _random.Next(1, 100));
        };
        toolbar.AddContentChild(button);

        button = new Button
        {
            Text = "Previous tab",
            SkinClass = typeof(ImageButtonSkin),
            Icon = ImageLoader.Instance.Load("Icons/previous")
        };
        button.Click += delegate
        {
            _buttonBar.SelectedIndex--;
            _viewstack.Previous();
        };
        toolbar.AddContentChild(button);

        button = new Button
        {
            Text = "Next tab",
            SkinClass = typeof(ImageButtonSkin),
            Icon = ImageLoader.Instance.Load("Icons/next")
        };
        button.Click += delegate
        {
            _buttonBar.SelectedIndex++;
            _viewstack.Next();
        };
        toolbar.AddContentChild(button);

        #endregion

        #region Scroller

        Scroller scroller = new Scroller
        {
            SkinClass = typeof (ScrollerSkin2),
            PercentWidth = 100,
            PercentHeight = 100
        };
        //scroller.SetStyle("horizontalScrollPolicy", ScrollPolicy.On);
        //scroller.SetStyle("verticalScrollPolicy", ScrollPolicy.On);
        AddChild(scroller);

        Group viewport = new Group
        {
            MouseEnabled = true,
            Layout = new VerticalLayout
            {
                HorizontalAlign = HorizontalAlign.Left,
                PaddingLeft = 10,
                PaddingRight = 10,
                PaddingTop = 10,
                PaddingBottom = 10,
                Gap = 10
            }
        };
        scroller.Viewport = viewport;

        #endregion

        List<object> source = new List<object> { "Failure", "Teaches", "Success", "One", "Two", "Three", "Four", "Five", "Six" };

        _dataProvider = new ArrayList(source);

        viewport.AddChild(new Label {Text = "ButtonBar:"});

        #region Button bar

        _buttonBar = new ButtonBar
        {
            DataProvider = new ArrayList(new List<object> {"List 1", "List 2", "List 3", "List 4", "List 5"}),
            SkinClass = typeof(ButtonBarSkin2),
            RequireSelection = true
        };
        _buttonBar.AddEventListener(Event.CHANGE, delegate(Event e)
        {
            IndexChangeEvent ice = e as IndexChangeEvent;
            if (null != ice)
            {
                int newIndex = ice.NewIndex;
                //Debug.Log("Changed to: " + newIndex);
//.........这里部分代码省略.........
开发者ID:groov0v,项目名称:edriven-gui,代码行数:101,代码来源:NavigatorDemo.cs

示例13: CreateChildren

    override protected void CreateChildren()
    {
        base.CreateChildren();

        #region Controls

        Toolbar toolbar = new Toolbar();
        AddChild(toolbar);

        Button button = new Button
        {
            Text = "Add data",
            SkinClass = typeof(ImageButtonSkin),
            Icon = ImageLoader.Instance.Load("Icons/star"),
            AutoRepeat = true
        };
        button.ButtonDown += delegate
        {
            _dataProvider.AddItem(
                new ExampleItem
                {
                    FirstName = "First" + _random.Next(1, 100),
                    LastName = "Last" + _random.Next(1, 100),
                    Age = _random.Next(1, 80),
                    DrivingLicense = _random.Next(0, 2) == 1
                }
            );
        };
        toolbar.AddContentChild(button);

        #endregion

        #region Scroller

        Scroller scroller = new Scroller
        {
            SkinClass = typeof (ScrollerSkin2),
            PercentWidth = 100,
            PercentHeight = 100
        };
        //scroller.SetStyle("horizontalScrollPolicy", ScrollPolicy.On);
        //scroller.SetStyle("verticalScrollPolicy", ScrollPolicy.On);
        AddChild(scroller);

        Group viewport = new Group
        {
            MouseEnabled = true,
            Layout = new VerticalLayout
            {
                HorizontalAlign = HorizontalAlign.Left,
                PaddingLeft = 10,
                PaddingRight = 10,
                PaddingTop = 10,
                PaddingBottom = 10,
                Gap = 10
            }
        };
        scroller.Viewport = viewport;

        #endregion

        #region Fill the data provider

        List<string> names = new List<string>
        {
            "Failure",
            "Teaches",
            "Success",
            "One",
            "Two",
            "Three",
            "Four",
            "Five",
            "Six"
        };

        List<object> source = new List<object>();
        foreach (var theName in names)
        {
            source.Add(
                new ExampleItem
                {
                    FirstName = theName,
                    LastName = theName,
                    Age = _random.Next(1, 10),
                    DrivingLicense = _random.Next(0, 2) == 1
                }
                );
        }

        _dataProvider = new ArrayList(source);

        #endregion

        HGroup hGroup = new HGroup { PercentWidth = 100, PercentHeight = 100 };
        viewport.AddChild(hGroup);

        #region Grid (header + list + footer)

        VGroup vGroup = new VGroup { PercentWidth = 100, PercentHeight = 100, Gap = 0 };
//.........这里部分代码省略.........
开发者ID:groov0v,项目名称:edriven-gui,代码行数:101,代码来源:GridDemo.cs

示例14: CreateChildren

    override protected void CreateChildren()
    {
        base.CreateChildren();

        #region Controls

        Toolbar toolbar = new Toolbar();
        AddChild(toolbar);

        #region Alert

        Button btnAlert = new Button
        {
            Text = "Alert",
            FocusEnabled = false,
            SkinClass = typeof(ImageButtonSkin),
            Icon = ImageLoader.Instance.Load("Icons/comment")
        };
        btnAlert.Click += delegate
        {
            Alert.Show("Info", "This is the example alert.", AlertButtonFlag.Ok,
                new AlertOption(AlertOptionType.HeaderIcon, Resources.Load<Texture>("Icons/information")),
                new AlertOption(AlertOptionType.Icon, Resources.Load<Texture>("Icons/star_big")));
        };
        toolbar.AddContentChild(btnAlert);

        #endregion

        #region Window

        Button btnWindow = new Button
        {
            Text = "New window",
            FocusEnabled = false,
            SkinClass = typeof(ImageButtonSkin),
            Icon = ImageLoader.Instance.Load("Icons/comment")
        };
        btnWindow.Click += delegate
        {
            _count++;
            var window = new MyWindow
            {
                Title = "The Window " + _count,
                Id = "window_" + _count,
                SkinClass = typeof(WindowSkin2),
                Icon = ImageLoader.Instance.Load("Icons/balloon_32"),
                Width = 400,
                Height = 600
            };

            window.SetStyle("addedEffect", _windowShow);
            window.Plugins.Add(new Resizable { ShowOverlay = false });
            window.AddEventListener(CloseEvent.CLOSE, delegate
            {
                PopupManager.Instance.RemovePopup(window);
            });
            PopupManager.Instance.AddPopup(window, false);
            PopupManager.Instance.CenterPopUp(window);
        };
        toolbar.AddContentChild(btnWindow);

        #endregion

        #endregion

        #region Scroller

        Scroller scroller = new Scroller
        {
            SkinClass = typeof (ScrollerSkin2),
            PercentWidth = 100, PercentHeight = 100
        };
        //scroller.SetStyle("horizontalScrollPolicy", ScrollPolicy.On);
        //scroller.SetStyle("verticalScrollPolicy", ScrollPolicy.On);
        AddChild(scroller);

        Group viewport = new Group
        {
            Layout = new VerticalLayout
            {
                HorizontalAlign = HorizontalAlign.Left,
                PaddingLeft = 10,
                PaddingRight = 10,
                PaddingTop = 10,
                PaddingBottom = 10,
                Gap = 10
            }
        };
        scroller.Viewport = viewport;

        #endregion
        
        #region Horizontal Scrollbars

        viewport.AddChild(new HScrollBar { SkinClass = typeof(HScrollBarSkin3), PercentWidth = 100, MinWidth = 300, Maximum = 300, PageSize = 100 });
        viewport.AddChild(new HScrollBar { SkinClass = typeof(HScrollBarSkin3), PercentWidth = 50, Maximum = 500, Value = 200, PageSize = 100 });
        viewport.AddChild(new HScrollBar { SkinClass = typeof(HScrollBarSkin2), MinWidth = 600, Maximum = 1000, PageSize = 100 });
        viewport.AddChild(new HScrollBar { SkinClass = typeof(HScrollBarSkin3), MinWidth = 700, Maximum = 300, PageSize = 100 });
        viewport.AddChild(new HScrollBar { PercentWidth = 100, MinWidth = 600, SkinClass = typeof(HScrollBarSkin3), Maximum = 1000, PageSize = 100 });

//.........这里部分代码省略.........
开发者ID:groov0v,项目名称:edriven-gui,代码行数:101,代码来源:BigMess.cs


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