Unimatrix_001
asked on
Custom control not refreshing on scroll.
Hi,
I have the following code below from a custom component, although my issue is that when I scroll away from the rectangle and then back on the control does not refresh so the rectangle keeps getting larger. I have to force a refresh by switching to a different application then back. How can I sort this?
Thanks,
Uni
I have the following code below from a custom component, although my issue is that when I scroll away from the rectangle and then back on the control does not refresh so the rectangle keeps getting larger. I have to force a refresh by switching to a different application then back. How can I sort this?
Thanks,
Uni
public partial class MyCustomControl:ScrollableControl {
//Constructor.
public MyCustomControl() {
InitializeComponent();
this.SetStyle(ControlStyles.OptimizedDoubleBuffer|ControlStyles.UserPaint|ControlStyles.AllPaintingInWmPaint, true);
this.AutoScroll=true;
this.AutoScrollMinSize=new Size(2000, 2000);
this.Paint+=new PaintEventHandler(MyCustomControl_Paint);
}
//The paint method.
private void MyCustomControl_Paint(object sender, PaintEventArgs e) {
e.Graphics.FillRectangle(Brushes.Azure, 0, 0, 20, 50);
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
:)
ASKER
https://www.experts-exchange.com/questions/24536910/Double-buffering-not-appearing-to-work.html
Thanks,
Uni