title: AppBar Multi-Monitor
body: <p>I've made a simple appBar with just a label on the top of the screen that shrinks the desktop but I'm having trouble making it appear my second monitor. I've been searching around but everything I've found has been for WPF. These are most likely the areas where I've made a mistake but if there is any other code you need to see, just let me know.</p>
  
  <pre><code>private void InitializeComponent()
  {
      this.ClientSize = new System.Drawing.Size(SystemInformation.WorkingArea.Width, -1);
      this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
      this.Name = "MainForm";
      this.Text = "AppBar";
      this.Closing += new System.ComponentModel.CancelEventHandler(this.OnClosing);
      this.Load += new System.EventHandler(this.OnLoad);
      this.BackColor = Color.Green;
      this.Padding = new Padding(0, 0, 0, 0);
      Label label1 = new Label();
      label1.Text = "TEXT";
      label1.Width = 270;
      label1.Margin = new Padding(0,0,0,0);
      label1.Padding = new Padding(0,0,0,0);
      label1.TextAlign = ContentAlignment.MiddleCenter;
      label1.ForeColor = Color.White;
      label1.Font = new Font(FontFamily.GenericSansSerif, 12,FontStyle.Regular);
      label1.Location = new Point((SystemInformation.WorkingArea.Width - 270) / 2, 0);
      this.Controls.Add(label1);
  }
  
  private void ABSetPos()
  {
      APPBARDATA abd = new APPBARDATA();
      abd.cbSize = Marshal.SizeOf(abd);
      abd.hWnd = this.Handle;
      abd.uEdge = (int)ABEdge.ABE_TOP;
  
      if (abd.uEdge == (int)ABEdge.ABE_LEFT || abd.uEdge == (int)ABEdge.ABE_RIGHT)
      {
          abd.rc.top = 0;
          abd.rc.bottom = SystemInformation.PrimaryMonitorSize.Height;
          if (abd.uEdge == (int)ABEdge.ABE_LEFT)
          {
              abd.rc.left = 0;
              abd.rc.right = Size.Width;
          }
          else
          {
              abd.rc.right = SystemInformation.PrimaryMonitorSize.Width;
              abd.rc.left = abd.rc.right - Size.Width;
          }
  
      }
      else
      {
          abd.rc.left = 0;
          abd.rc.right = SystemInformation.PrimaryMonitorSize.Width;
          if (abd.uEdge == (int)ABEdge.ABE_TOP)
          {
              abd.rc.top = 0;
              abd.rc.bottom = Size.Height;
          }
          else
          {
              abd.rc.bottom = SystemInformation.PrimaryMonitorSize.Height;
              abd.rc.top = abd.rc.bottom - Size.Height;
          }
      }
  </code></pre>