2
2G
Hi,
I've a usercontrol that fills a listview with data from my db, I had
this.SuspendLayout() in the beginning and this.ResumeLayout at the end of
the function that loads the data and all worked fine. But now that I have
threaded the function (refreshdata), the SuspendLayout and ResumeLayout()
doesn't work any more, I tried solving it with Invoke() but with no succes.
public UserControl1(){
this.SuspendPaint += new DSuspendPaint(this.SuspendPaintProc);
}
private delegate void DSuspendPaint(bool b);
private event DSuspendPaint SuspendPaint;
private void SuspendPaintProc(bool b){
if(b)
this.listView1.SuspendLayout();
else
this.listView1.ResumeLayout();
}
public void RefreshData(){
this.Invoke(this.SuspendPaint, new object[]{ true });
...load data and fill listview
this.Invoke(this.SuspendPaint, new object[]{ false });
}
I've a usercontrol that fills a listview with data from my db, I had
this.SuspendLayout() in the beginning and this.ResumeLayout at the end of
the function that loads the data and all worked fine. But now that I have
threaded the function (refreshdata), the SuspendLayout and ResumeLayout()
doesn't work any more, I tried solving it with Invoke() but with no succes.
public UserControl1(){
this.SuspendPaint += new DSuspendPaint(this.SuspendPaintProc);
}
private delegate void DSuspendPaint(bool b);
private event DSuspendPaint SuspendPaint;
private void SuspendPaintProc(bool b){
if(b)
this.listView1.SuspendLayout();
else
this.listView1.ResumeLayout();
}
public void RefreshData(){
this.Invoke(this.SuspendPaint, new object[]{ true });
...load data and fill listview
this.Invoke(this.SuspendPaint, new object[]{ false });
}