zoukankan      html  css  js  c++  java
  • 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删掉。

  • 相关阅读:
    os 模块删除图片操作
    python base64基本使用
    django 跨域
    git 回滚
    多线程
    原生sql子查询 和psql 子查询
    Python 3.x 中"HTTP Error 403: Forbidden"问题的解决方案
    报错(AttributeError: 'str' object has no attribute 'items')的解决办法
    C++虚函数
    C++泛型程序设计和多态
  • 原文地址:https://www.cnblogs.com/nankezhishi/p/1377366.html
Copyright © 2011-2022 走看看