Airspace issuse and wpfairspace
The airspace problem is caused by the differences between Winform and WPF in the underlying rendering mechanism. In most cases, developers encounter such problems in order to implement irregular forms and carry the Winform control. When the WPF form is set to allow transparency (that is, AllowsTransparency = True), Winform Control will not be displayed. To avoid this problem, many UI frameworks implement irregular forms, the Win32 API is used to implement some special effects of irregular forms, such as transparency and rounded corners. In this way, the AllowsTransparency attribute of the WPF window can be set to FALSE, thus bypassing the airspace issue. However, the development costs for those who have not been familiar with the underlying development of windows are relatively high, and in some special cases, the AllowsTransparency must be set to True. How can this problem be solved?
- The first method is the most common method on the network. Simply put, it is an embedded form. This method is not described.
- The second solution is to use a third-party library to solve the airspace problem.
Use third-party libraries to solve airspace problems
Microsoft. DwayneNeed (
Https://microsoftdwayneneed.codeplex.com/
), This library is also written in the project introduction.
Mitigating "airspace" issues in WPF applications.
It may be seen that this database cannot solve the problem of airspace perfectly, and it can only be improved by Microsoft.
Take the powerful WebBrower in Winform as an example to briefly describe how to use it:
- Create a WPF form project and add Microsoft. DwayneNeed. dll and Microsoft. DwayneNeed. Win32.dll references.
- Add the xmlns: airspace = "clr-namespace: Microsoft. DwayneNeed. Interop; assembly = Microsoft. DwayneNeed" Statement
<airspace:AirspaceDecorator AirspaceMode="Redirect" IsInputRedirectionEnabled="True" IsOutputRedirectionEnabled="True"> <WindowsFormsHost Name="FormsHost"> <winform:WebBrowser/> </WindowsFormsHost></airspace:AirspaceDecorator>
The above is an introduction to the Airspace issuse in WPF. I hope it will help you. If you have any questions, please leave a message, the editor will reply to you in a timely manner. Thank you very much for your support for the help House website!