Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

BackgroundWorker for OnPaint stuff

$
0
0

I have OnPaint() function that does some rendering custom controls. But unfortunately it lags as i add more and more controls. Is there anyway i can make the OnPaint() as a background worker? For eg i have the below code. CustomRenderer.Render() is what i want in a background worker.

protected override void OnPaint(PaintEventArgs e)
{
    base.OnPaint(e);

    if (e.Graphics == null)
        return;

    CustomRenderer.PerformLayout(e.Graphics, customControls);
    CustomRenderer.Render(e.Graphics, customControls); //I want this Render in a background thread. 
}



Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>