

Form1.cs
using System;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
private static Form2 Form2 = null;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void Form1_Shown(object sender, EventArgs e)
{
int x = (Screen.PrimaryScreen.Bounds.Width / 2) - this.Width;
int y = (Screen.PrimaryScreen.Bounds.Height - this.Height) / 2;
this.Location = new Point(x, y);
Form2 = new Form2(this);
x += this.Width;
Form2.Show();
Form2.Location = new Point(x, y);
Form2.Focus();
}
public bool trackBar4Visible
{
get { return trackBar4.Visible; }
set { trackBar4.Visible = value; }
}
}
}
Form2.cs
using System;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form2 : Form
{
private static Form1 Form1 = null;
public Form2(Form callingForm)
{
Form1 = callingForm as Form1;
InitializeComponent();
button1.Text = "Form2.TrackBar.Visible - Toggle\n"
+ "Form1.TrackBar.Visible - Toggle";
}
private void Form2_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
Form1.trackBar4Visible = (!Form1.trackBar4Visible) ? true : false;
trackBar1.Visible = (!trackBar1.Visible) ? true : false;
}
}
}

