WPF窗体设计不符合微软自己的UX Guide

冲突的地方就在于窗体应该不应该有左上角的图标?不知大家平时有没有注意这个问题?

 

这个谁说都没有用,看看微软的已经有的软件,主窗体都有,从主窗体弹出的绝大多数子窗体都没有。再来看看微软自己的UX Guide上是怎么说的。

 

Title bars

Dialog boxes dont have title bar icons. Title bar icons are used as a visual distinction between primary windows and

secondary windows.

􀀀m Exception: If a dialog box is used to implement a primary window (such as a utility) and therefore appears on the taskbar, it does have

a title bar icon. In this case, optimize the title for display on the taskbar by concisely placing the distinguishing information first.

 

                                                                                                Page 421 in pdf

 

 

Title bar icons

Dialog boxes dont have title bar icons.

􀀀m Exception: If a dialog box is used to implement a primary window (such as a utility) and therefore appears on the taskbar, it does have

a title bar icon.

 

                                                                                                                                  Page 426 in pdf

 

Icons

Modal error message dialogs dont have title bar icons. Title bar icons are used as a visual distinction between primary windows

and secondary windows.

                                                                                                         Page 541 in pdf

 

程序里的不在任务栏里的弹出框实在是太常见了,而现有的程序和UX Guide都告诉我们这个弹出框上不应该有左上角的Icon。好,知道了,以后这么做就是了。

 

等等,WPFWindow不愿意给你这个机会!看看WPF的MSDN上是怎么说的。

 

A WPF window always displays an icon. When one is not provided by setting Icon, WPF chooses an icon to display based on the following rules:

  1. Use the assembly icon, if specified.
  2. If the assembly icon is not specified, use the default Microsoft Windows icon.

 

 

得,微软自己两个TEAM打起来了。说直接点就是,WPFWindow没有WinFormForm里的ShowIcon属性。

 

当然人不能让尿憋死,办法总是有的。不过要直接调用Win32 API。介绍在这里。我在项目里也试了一下(毕竟UX优先级高些),不是很好用。后来看了看Form里的ShowIcon方法是如何实现的才正确地解决了。要在上面的方法的基础上,SetWindowPos之后,再用下面的代码给Window发两个消息。

 

SendMessage(hwnd, 0x80, 0, 0);

SendMessage(hwnd, 0x80, 1, 0);

 

才能把Icon删掉。

posted on 2009-01-17 00:11  南柯之石  阅读(1261)  评论(2编辑  收藏  举报

导航