阅读全文
这几个控件写的时间很长了,由于时间关系一直没有做完。但是不知道什么时候才能做完,现在放出来,有兴趣的可以自己拿去看看。包括源代码。基本效果如下。
只有这个主窗口设计了两种基本的颜色方案,鄙人不是美工效果肯定不是很如意,凑合看吧。
话不多说,代码在这里:
http://files.cnblogs.com/YilingLai/WPFControls.zip
不管首页是否合适,不合适的就撤了吧!
在Windows SDK中关于WindowInteropHelper类的介绍中,关于其Owner属性的说明和实现有些问题。
原文是:An example scenario is if you need to host a WPF dialog box in a Win32 application. Initialize the WindowInteropHelper 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 WindowInteropHelper when hosting a WPF dialog box in a Win32 application.
大意是通过WindowInteropHelper的Owner属性可以把WPF窗口的Owner属性设置为一个Win32的窗口句柄HWND。但是这个功能的实现是有问题的。有兴趣的朋友可以通过下面的代码进行测试:
Window myDialog = new Window();
myDialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
WindowInteropHelper wih = new WindowInteropHelper(myDialog);
wih.Owner = ownerHwnd;
myDialog.ShowDialog();
这段代码最后显示的窗口不会位于Owner窗口的中心。事实上,WindowInteropHelper.Owner属性设置的是Window类的_ownerHandle成员。这个成员和Window.Owner设置的成员不是同一个。因此,文档中的说明和WPF的实际实现不相符的。这个问题基本已经确认是WPF的一个BUG。
阅读全文
