WindowsFormsHost is a control in WPF that hosts Windows Form types, and it has a particularly high priority and can be covered by other types of controls on the same window.
To be able to float the control on the WindowsFormsHost window and achieve a translucent effect, you can pop another window on the WPF window that hosts the WindowsFormsHost, which is the same size as the bottom window, and the position changes as the bottom window changes.
Specific implementation:
Suppose there are two windows: MainWindow and Floatwindow, where MainWindow is the window that hosts WindowsFormsHost, and Floatwindow is the window that floats above.
Initialize the floating window in the MainWindow loaded event, and make the window size and position change, see the code in detail.
_floatwin = new Floatwindow (this);
_floatwin.owner = this;
_floatwin.showintaskbar = false;
_floatwin.show ();
_floatwin.left = this. Left;
_floatwin.top = this. Top;
_floatwin.width = this. Width;
_floatwin.height = this. Height;
This allows the floating window and the bottom of the window to maintain the size and position of the same, and then set the transparent effect of the floating window, in the floating window of the XAML set the main window of the two properties, allowstransparency= "True" background= " Transparent "After the floating window can be arbitrarily added control, set the control's Opacity property, you can implement the control translucent.
This article is from the "Wclwksn_gis" blog, make sure to keep this source http://speciallst.blog.51cto.com/9749849/1834247
WindowsFormsHost floating control methods in WPF