title: Buttons blank when Windows Forms application is started
body: <p>When I open my Windows Forms application for the first time some of the buttons do not render correctly, when the form is move slightly they appear. </p>
  
  <p>See below.</p>
  
  <p><a href="https://i.stack.imgur.com/FPGyv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FPGyv.png" alt="before"></a></p>
  
  <p>after dragging the form they appear.</p>
  
  <p><a href="https://i.stack.imgur.com/pN4cm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pN4cm.png" alt="after"></a></p>
  
  <p>This is my startup code.</p>
  
  <pre><code>[STAThread]
  static void Main()
  {
      bool createdNew = true;
  
      using (Mutex mutex = new Mutex(true, "Support_Desk_System", out createdNew))
      {
          if (createdNew)
          {
              Application.EnableVisualStyles();
              Application.SetCompatibleTextRenderingDefault(false);
              Application.Run(new Form1());
              GC.KeepAlive(mutex);
          }
          else
          {
              Process current = Process.GetCurrentProcess();
  
              foreach (Process process in Process.GetProcessesByName(current.ProcessName))
              {
                  if (process.Id != current.Id)
                  {
                      SetForegroundWindow(process.MainWindowHandle);
                      break;
                  }
              }
          }
      }
  }
  </code></pre>
  
  <p>It's not a major issue just annoying because i have no idea why it's happening.</p>
  
  <p>This is the form code.</p>
  
  <pre><code>public partial class Form1 : Form
  {
      public Form1()
      {
          InitializeComponent();
      }
  
      private void Form1_Load(object sender, EventArgs e)
      {
          this.status_CodesTableAdapter.Fill(this.supportDeskDataSet.Status_Codes);
          this.systemsTableAdapter.Fill(this.supportDeskDataSet.Systems);
          this.cases_Quick_ViewTableAdapter.Fill(this.supportDeskDataSet.Cases_Quick_View);
          this.dataGridView1.DoubleBuffered(true);
      }
  
      private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
      {
          foreach (DataGridViewRow Myrow in dataGridView1.Rows)
          {    
              if (Myrow.Cells[7].Value.ToString() == "High")
              {
                  Myrow.DefaultCellStyle.BackColor = Color.Red;
              }
              else
              {
                  Myrow.DefaultCellStyle.BackColor = Color.Green;
              }
              if(Myrow.Cells[2].Value.ToString() == "Back Burner")
              {
                  Myrow.DefaultCellStyle.BackColor = Color.Gray;
                  Myrow.DefaultCellStyle.ForeColor = Color.White;
              }
          }
      }
  }
  public static class DataGridViewExtensioncs
  {
      public static void DoubleBuffered(this DataGridView dgv, bool setting)
      {
          var dgvType = dgv.GetType();
          var pi = dgvType.GetProperty("DoubleBuffered",
          BindingFlags.Instance | BindingFlags.NonPublic);
          pi.SetValue(dgv, setting, null);
      }
  }
  </code></pre>