Inheritance: AnimationBase
Exemplo n.º 1
0
        protected override void OnActivated(EventArgs e)
        {
            if (!isInitialized)
            {
                controlContainer.Theme = Theme;
                controlContainer.Style = Style;
                controlContainer.StyleManager = StyleManager;

                MaximizeBox = false;
                MinimizeBox = false;
                Movable = true;

                TopMost = true;

                Size = new Size(500, 300);

                if (enableTaskBar == true)
                {
                    Taskbar myTaskbar = new Taskbar();
                    switch (myTaskbar.Position)
                    {
                        case TaskbarPosition.Left:
                            Location = new Point(myTaskbar.Bounds.Width + 5, myTaskbar.Bounds.Height - Height - 5);
                            break;
                        case TaskbarPosition.Top:
                            Location = new Point(myTaskbar.Bounds.Width - Width - 5, myTaskbar.Bounds.Height + 5);
                            break;
                        case TaskbarPosition.Right:
                            Location = new Point(myTaskbar.Bounds.X - Width - 5, myTaskbar.Bounds.Height - Height - 5);
                            break;
                        case TaskbarPosition.Bottom:
                            Location = new Point(myTaskbar.Bounds.Width - Width - 5, myTaskbar.Bounds.Y - Height - 5);
                            break;
                        case TaskbarPosition.Unknown:
                        default:
                            Location = new Point(Screen.PrimaryScreen.Bounds.Width - Width - 5, Screen.PrimaryScreen.Bounds.Height - Height - 5);
                            break;
                    }
                }
                controlContainer.Location = new Point(0, 60);
                controlContainer.Size = new Size(Width - 40, Height - 80);
                controlContainer.Anchor = AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom | AnchorStyles.Left;

                controlContainer.AutoScroll = false;
                controlContainer.HorizontalScrollbar = false;
                controlContainer.VerticalScrollbar = false;
                controlContainer.Refresh();

                if (StyleManager != null)
                {
                    StyleManager.Update();
                }

                isInitialized = true;

                MoveAnimation myMoveAnim = new MoveAnimation();
                myMoveAnim.Start(controlContainer, new Point(20, 60), TransitionType.EaseInOutCubic, 15);
            }

            base.OnActivated(e);
        }
        protected override void OnActivated(EventArgs e)
        {
            if (!isInitialized)
            {
                controlContainer.Theme = Theme;
                controlContainer.Style = Style;
                controlContainer.StyleManager = StyleManager;

                MaximizeBox = false;
                MinimizeBox = false;
                Movable = false;

                TopMost = true;
                FormBorderStyle = FormBorderStyle.FixedDialog;

                Size = new Size(400, 200);

                Taskbar myTaskbar = new Taskbar();
                switch (myTaskbar.Position)
                {
                    case TaskbarPosition.Left:
                        Location = new Point(myTaskbar.Bounds.Width + 5, myTaskbar.Bounds.Height - Height - 5);
                        break;
                    case TaskbarPosition.Top:
                        Location = new Point(myTaskbar.Bounds.Width - Width - 5, myTaskbar.Bounds.Height + 5);
                        break;
                    case TaskbarPosition.Right:
                        Location = new Point(myTaskbar.Bounds.X - Width - 5, myTaskbar.Bounds.Height - Height - 5);
                        break;
                    case TaskbarPosition.Bottom:
                        Location = new Point(myTaskbar.Bounds.Width - Width - 5, myTaskbar.Bounds.Y - Height - 5);
                        break;
                    case TaskbarPosition.Unknown:
                    default:
                        Location = new Point(Screen.PrimaryScreen.Bounds.Width - Width - 5, Screen.PrimaryScreen.Bounds.Height - Height - 5);
                        break;
                }

                controlContainer.Location = new Point(0, 60);
                controlContainer.Size = new Size(Width - 40, Height - 80);
                controlContainer.Anchor = AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom | AnchorStyles.Left;

                StyleManager.Update();

                isInitialized = true;

                MoveAnimation myMoveAnim = new MoveAnimation();
                myMoveAnim.Start(controlContainer, new Point(20, 60), TransitionType.EaseInOutCubic, 15);
            }

            base.OnActivated(e);
        }
Exemplo n.º 3
0
        public MetroSidePanel()
        {
            MetroSkinManager.ApplyMetroStyle(this);
            m_moveAnim = new MoveAnimation();
            Padding = new Padding(4);

            MetroPanel contentPanel = new MetroPanel();
            MetroSkinManager.ApplyMetroStyle(contentPanel);
            contentPanel.Dock = DockStyle.Fill;
            Controls.Add(contentPanel);

            m_content = new MetroPanel();
            MetroSkinManager.ApplyMetroStyle(m_content);
            m_content.Dock = DockStyle.Fill;
            m_content.Controls.Clear();
            m_content.ControlAdded += new ControlEventHandler(m_content_ControlAdded);
            m_content.ControlRemoved += new ControlEventHandler(m_content_ControlRemoved);
            contentPanel.Controls.Add(m_content);

            m_contentScrollbarV = new MetroScrollBar(MetroScrollOrientation.Vertical);
            MetroSkinManager.ApplyMetroStyle(m_contentScrollbarV);
            m_contentScrollbarV.Dock = DockStyle.Right;
            m_contentScrollbarV.Scroll += new ScrollEventHandler(m_contentScrollbarV_Scroll);
            contentPanel.Controls.Add(m_contentScrollbarV);

            m_contentScrollbarH = new MetroScrollBar(MetroScrollOrientation.Horizontal);
            MetroSkinManager.ApplyMetroStyle(m_contentScrollbarH);
            m_contentScrollbarH.Dock = DockStyle.Bottom;
            m_contentScrollbarH.Scroll += new ScrollEventHandler(m_contentScrollbarH_Scroll);
            contentPanel.Controls.Add(m_contentScrollbarH);

            MetroPanel titlePanel = new MetroPanel();
            MetroSkinManager.ApplyMetroStyle(titlePanel);
            titlePanel.Height = 20;
            titlePanel.Dock = DockStyle.Top;
            Controls.Add(titlePanel);

            m_titleBar = new MetroTile();
            MetroSkinManager.ApplyMetroStyle(m_titleBar);
            m_titleBar.Text = "SidePanelControler";
            m_titleBar.Height = titlePanel.Height;
            m_titleBar.Click += new EventHandler(m_titleBar_Click);
            titlePanel.Controls.Add(m_titleBar);

            m_dockImage = Bitmap.FromFile("resources/icons/appbar.pin.png");
            m_undockImage = Bitmap.FromFile("resources/icons/appbar.pin.remove.png");
            m_dockTile = new MetroTileIcon();
            MetroSkinManager.ApplyMetroStyle(m_dockTile);
            m_dockTile.Size = new Size(titlePanel.Height, titlePanel.Height);
            m_dockTile.Image = m_dockImage;
            m_dockTile.ImageAlign = ContentAlignment.MiddleCenter;
            m_dockTile.IsImageScaled = true;
            m_dockTile.ImageScale = new PointF(0.5f, 0.5f);
            m_dockTile.Click += new EventHandler(m_dockTile_Click);
            titlePanel.Controls.Add(m_dockTile);

            Load += new EventHandler(SidePanelControl_Load);
            ParentChanged += new EventHandler(SidePanelControl_ParentChanged);

            Fit();
            Apply();
            UpdateScrollbars();
        }