0

Im using a WinForm and an ElementsHost object to host a WPF control.

    public partial class ImportForm : DockContent
    {
        private ElementHost ctrlHost;    
        public ImportForm
        { 
            InitializeComponent();
            ctrlHost = new ElementHost();
            ctrlHost.Dock = DockStyle.Fill;
            ImportDockContent dockContent = new ImportDockContent();
            ctrlHost.Child = dockContent;
            this.Controls.Add(ctrlHost);    
        }
    }

Unfortunately this form will flicker when i resize it. I tryed something with suspendlayout and resume layout in the resize event of the form, but that didnt help. Does anybody know what to do to stop this?

thanks for your help.

user3596113
  • 868
  • 14
  • 32
  • 3
    This is one of the problems with winforms doing all graphic processing on the processor, you can try enable `DoubleBuffering` on the form properties, but for the most part, it will continue to flicker. There are loads of questions on StackOverflow regarding this issue, and I've tried most of them, but depending on your forms layout its just something to live with (unless you convert to wpf) – Sayse Aug 15 '14 at 06:24
  • You may perhaps try SuspendPaint and ResumePaint for less flicker, these methods are available via win api. find an answer for the same at [How do I suspend painting for a control and its children?](http://stackoverflow.com/questions/487661/how-do-i-suspend-painting-for-a-control-and-its-children) – pushpraj Aug 15 '14 at 07:33

0 Answers0