Click here to Skip to main content
15,886,001 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I want to make a auto hide sidebar.
as we can see in visual studio the toolbox and other property windows use to open at left or at right side of the window

Please tell me solution of this or anything similar to this

Thank you
Posted

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.


C#
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.
 
Share this answer
 
Comments
[no name] 21-Dec-12 5:19am    
is it possible to share the screen..??means image if u can snapshot..
Anaya Upadhyay 21-Dec-12 6:13am    
it would be possible, but will you tell me how to upload the snapshot
You can upload on the website Ge.tt and give him the link so that he can download and refer that.

Thanks...
[no name] 21-Dec-12 6:49am    
Please upload ur screen view..then it will be easy for me to understand the thing..
Please check
1. Article - A Visual Studio 2005-like Interface[^],
2. Question - Auto hide side bar[^].

Thanks...
 
Share this answer
 
Comments
[no name] 21-Dec-12 5:37am    
Thanks..
Please accept this answer, if it has helped you in any way.
This will help others to find the answer in one go and you will also be awarded with some points for this action...

Thanks,
Tadit
Thanks for accepting the answer @Snehasish.
[no name] 21-Dec-12 6:22am    
Thank u..@tadit
You are most welcome, my pleasure @Snehasish.
I've shared the file here.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900