How do I disable updating a form in Windows Forms?

During a complicated update I might prefer to display all the changes at once. I know there is a method that allows me to do this, but what is it?


I think this.SuspendLayout() & ResumeLayout() should do it

I don't find SuspendLayout() and ResumeLayout() does what you are asking for. The LockWindowsUpdate() metioned by moobaa does the trick. However, the LockWindowUpdate only works for one window at a time.

You can also try this:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.Win32;
using System.Runtime.InteropServices;

namespace WindowsTest
  public partial class Form1 : Form
    public static extern int SendMessage(IntPtr hWnd, Int32 wMsg, bool wParam, Int32 lParam);
    private const int WM_SETREDRAW = 11; 

    public Form1()

    private void button1_Click(object sender, EventArgs e)
      SendMessage(this.Handle, WM_SETREDRAW, false, 0);

      // Do your thingies here

      SendMessage(this.Handle, WM_SETREDRAW, true, 0);


Need Your Help

Set a new layout for a fragment

android layout fragment

Is it possible to set a new layout for a fragment, in a way similar to Activity.setContentView? Or the only way to change the layout of a fragment is to replace it, and inflate a different layout d...

Push data to Siri

ios voice-recognition siri

I know it is a long shoot but, is there any way to push data to Siri on iOS.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.