且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

需要帮助开发自动隐藏侧边栏

更新时间:2023-10-03 21:56:22

我今天早上做的就像你说的那样。



1.添加一个面板并将其命名为ObjectExplorerPanel。

2.在上面的面板中添加一个pinButton按钮(用于固定和取消固定)并将其文本设置为pin。 br />
3.在上面的面板中添加一个explorerCloseButton按钮(用于关闭侧边栏)。

4.在ShowOExpButton面板中添加一个按钮。



并执行此处的代码。





I was doing something like you said this morning.

1. Add a panel and name it "ObjectExplorerPanel".
2. Add a button "pinButton" (for pinning and un-pinning) and set it''s text to "pin", within the above panel.
3. Add a button "explorerCloseButton" (for closing the sidebar) within the above panel.
4. Add a button out of the panel "ShowOExpButton".

And do the code as it is here.


namespace Mero
{
    public partial class MeroMain : Form
    {
        public MeroMain()
        {
            InitializeComponent();
        }

        private void explorerCloseButton_Click(object sender, EventArgs e)
        {
            this.ObjectExplorerPanel.Hide();
        }

        private void objectExplorerToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.ObjectExplorerPanel.Show();
        }

        private void pinButton_Click(object sender, EventArgs e)
        {
            if (this.pinButton.Text == "pin")
            {
                this.pinButton.Text = "unpin";
                this.pinButton.BackgroundImage = Properties.Resources.unpin;
                this.ObjectExplorerPanel.Size = new Size(0, 438);
                this.showOExpButton.BringToFront();
            }
            else if (this.pinButton.Text == "unpin")
            {
                this.pinButton.Text = "pin";
                this.pinButton.BackgroundImage = Properties.Resources.pin;
                this.ObjectExplorerPanel.Size = new Size(200, 438);
            }
        }

        private void showOExpButton_Click(object sender, EventArgs e)
        {
            this.ObjectExplorerPanel.Size = new Size(200, 438);
            this.showOExpButton.SendToBack();
        }

        private void ObjectExplorerPanel_MouseLeave(object sender, EventArgs e)
        {
            if (this.pinButton.Text == "unpin")
            {
                this.ObjectExplorerPanel.Size = new Size(0, 438);
                this.showOExpButton.BringToFront();
            }
        }
    }
}





我无法上传文件,我把代码贴在这里。





希望这会有所帮助。



I could not upload the file so, i pasted the code over here.


Hope this helps.


请检查

1文章 - 类似Visual Studio 2005的界面 [ ^ ],>
2.问题 - 自动隐藏侧栏 [ ^ ]。



谢谢...
Please check
1. Article - A Visual Studio 2005-like Interface[^],
2. Question - Auto hide side bar[^].

Thanks...


我已共享文件此处