If the UI is the main thread to load will not flicker, put the code through an authorized load data into the child thread will be flashing, I am a custom controls, also USES the double caching mechanisms such as online said, also tried beginupdata method, are useless, do not know to have bosses to know why, and loading before 9 rows of data not flashing, flashing began from the first ten lines in question,
CodePudding user response:
Modified double cache TreeView, a list of don't know work, don't give it a try, the TreeView flash
Public class ListViewEx: ListView { Protected override void OnHandleCreated (EventArgs e) { SendMessage (this Handle, TVM_SETEXTENDEDSTYLE, IntPtr TVS_EX_DOUBLEBUFFER, IntPtr TVS_EX_DOUBLEBUFFER); Base. OnHandleCreated (e); } Private const int TVM_SETEXTENDEDSTYLE=0 x1100 + 44; Private const int TVM_GETEXTENDEDSTYLE=0 x1100 + 45; Private const int TVS_EX_DOUBLEBUFFER=0 x0004; [DllImport (" user32. DLL)] Private static extern IntPtr SendMessage (IntPtr hWnd, int MSG, IntPtr wp, IntPtr lp); } CodePudding user response:
reference 1st floor desperaso response: modify the double cache TreeView, I don't know the list don't work, don't give it a try, the TreeView flash Public class ListViewEx: ListView { Protected override void OnHandleCreated (EventArgs e) { SendMessage (this Handle, TVM_SETEXTENDEDSTYLE, IntPtr TVS_EX_DOUBLEBUFFER, IntPtr TVS_EX_DOUBLEBUFFER); Base. OnHandleCreated (e); } Private const int TVM_SETEXTENDEDSTYLE=0 x1100 + 44; Private const int TVM_GETEXTENDEDSTYLE=0 x1100 + 45; Private const int TVS_EX_DOUBLEBUFFER=0 x0004; [DllImport (" user32. DLL)] Private static extern IntPtr SendMessage (IntPtr hWnd, int MSG, IntPtr wp, IntPtr lp); } You mean double cache is only applicable to the treeview? CodePudding user response:
The reference autumn, maple falls on the second floor response: what do you mean double cache only apply treeview? ListView tried? Have the effect? CodePudding user response:
Listview virtual loading CodePudding user response:
Used double cache didn't encounter this problem, or your code where there is a problem, you can post up code CodePudding user response:
Don't need to bother, before update with a listView. SuspendLayout layout (), and update is completed with a listView. ResumeLayout () to restore the layout is ok CodePudding user response:
Double buffer should be,