Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
1808 | Nov 27,2002 01:29 PM UTC | Nov 28,2002 03:08 AM UTC | WinForms | 2 |
![]() |
Tags: GridControl |
public static bool InDoEvents = false; private void button1_Click(object sender, System.EventArgs e) { this.gridControl1.BeginUpdate(); this.gridControl1.Refresh(); Console.WriteLine("before Application.DoEvents"); Form1.InDoEvents = true; Application.DoEvents(); Form1.InDoEvents = false; Console.WriteLine("after Application.DoEvents"); this.gridControl1.EndUpdate(); }Then override the grid's WndProc and process the WM_PAINT if you are in the DoEvents loop.
public class MyGridControl : GridControl { public const int WM_PAINT = 15; protected override void WndProc(ref System.Windows.Forms.Message msg) { if(Form1.InDoEvents && msg.Msg == WM_PAINT) DefWndProc(ref msg); else base.WndProc(ref msg); } }One other comment is that if you want to have a progress bar on a different thread, then there is such a bar in the Shared library. If you look at the GridPopulationSample that ships with the grid, it uses it to put up a prgress bar if something is taking a long time (lik eusing the Indexer method to populate a 1000x1000 grid).
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.