Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Windows From's control are getting distorted while hosting them in WindowsFromsHost in WPF application

$
0
0

Hi,

I am currently migrating an existing win form C# application to WPF. So we are not rewriting existing WinForm, instead we are showing existing winform dialogs to user using WindowsFormsHost class. While doing so, dialog looks fine with Windows7 small settings [Control Panel->Display->Small] while if i open the same dialog on Medium display settings of Win7 OS then dialogs' control's are distorted and overlapped. While existing winform application shows dialogs proper in both display settings.

Can you please guide me how to correct the same in WPF? Sample code which i am using to show existing win form on WPF window is below -

                WindowsFormsHost hostForm = new WindowsFormsHost();               
                //WinForm object
                WinForm1 frmObj= new WinForm1 ();            
                frmObj.TopLevel = false;
                hostForm.Child = frmObj;
                this.grid1.Children.Add(hostForm); //grid1 is control in WPF window

Any help would be highly appreciable.


ITChamp




Viewing all articles
Browse latest Browse all 18858

Trending Articles



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