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.