WPF bug about javaswinterophelper

Source: Internet
Author: User

In the introduction to the javaswinterophelper class in the Windows SDK, there are some problems with the description and implementation of its owner attribute.

Original article: An Example scenario is if you need to host a WPF dialog box in a Win32 application. initialize the specified winterophelper with a WPF window object for the dialog. you can then get the WPF window's handle (hwnd) from the handle property and specify the owner for the WPF window with the owner property. the following code example shows how to use your winterophelper when hosting a WPF dialog box in a Win32 application.

The purpose is to set the owner attribute of the WPF window to a Win32 window handle hwnd through the owner attribute of javaswinterophelper. However, the implementation of this function is problematic. If you are interested, you can use the followingCodeTest:

Window mydialog = new window ();
Mydialog. windowstartuplocation = windowstartuplocation. centerowner;
Export winterophelper wih = new export winterophelper (mydialog );
Wih. Owner = ownerhwnd;
Mydialog. showdialog ();

the last window displayed in this Code is not in the center of the owner window. In fact, the windowinterophelper. Owner attribute is set to the _ ownerhandle Member of the window class. This member is not the same as the member set by window. Owner. Therefore, the description in this document does not match the actual implementation of WPF. This problem is basically a bug in WPF.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.