• 关于窗口属性的小应用


    1.基本上所有程序打开主界面都会在任务栏出现一个代表本窗口界面的图标,但是有一些却没有出现在任务栏,那么要怎么实现呢?这个只要在创建窗口的时候调用CreateWindowEx函数并使用WS_EX_TOOLWINDOW扩展属性即可。

    2.在xp系统下,窗口右边及下边是没有阴影效果,这样表现立体感就不强。可以通过这样来实现窗口阴影效果:::SetClassLong(*this, GCL_STYLE, ::GetClassLong(*this, GCL_STYLE) | CS_DROPSHADOW);

    3.如果你想要固定窗口的尺寸,不想让用户双击最大化以及禁用最大化图标,那么你可以:cs.style&=~WS_MAXIMIZEBOX;这样使用,用户就无法最大化窗口了。但是这样设置了用户依然可以通过鼠标拖动来调整窗口大小,那么你就需要不可调边框的窗口了,这样实现:cs.style&=~WS_THICKFRAME;或者cs.style&=~WS_SIZEBOX;这两个是一样的。将这两组代码一起使用将的到即不能最大化有不能调整大小的窗口了。

    4.有一些窗口它总是显示在其他的窗口之上,这种称为顶层窗口。比如QQ的主界面窗口就是一个顶层窗口,只要你显示了QQ主界面,那么无论你的焦点在哪个窗口上,它都不会被其他窗口遮住(当然可以被其他同样是顶层窗口遮住)。要实现一个顶层窗口有两种方法:第一种是在CreateWindowEx中使用WS_EX_TOPMOST扩展属性;第二种是使用SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);这个函数来实现。SetWindowPos函数的功能还不止设置顶层窗口,它还可以改变窗口大小、位置信息。

    5.WS_EX_NOACTIVATE这个属性先了解下:A top-level window created with this style does not become the foreground window when the user clicks it. The system does not bring this window to the foreground when the user minimizes or closes the foreground window.To activate the window, use the SetActiveWindow or SetForegroundWindow function.The window does not appear on the taskbar by default. To force the window to appear on the taskbar, use the WS_EX_APPWINDOW style.

    6.WS_OVERLAPPEDWINDOW默认带有WM_MAXIMIZEBOX属性,固默认可以双击最大化。WS_POPUPWINDOW默认有WS_BORDER,WS_POPUP和WS_SYSMENU属性,没有WM_MAXIMIZEBOX属性,固POPUPWINDOW默认无法双击最大化。

    7.WM_NCCALCSIZE:When wParam is TRUE, simply returning 0 without processing the NCCALCSIZE_PARAMS rectangles will cause the client area to resize to the size of the window, including the window frame. This will remove the window frame and caption items from your window, leaving only the client area displayed.当处理WM_NCCALCSIZE时,wParam为TRUE且返回0,则窗口的标题栏及窗口边框会去除,只显示客户区。

  • 相关阅读:
    函数要多小才够好——谈小函数之道
    vb.net 打字练习
    vb.net 打字练习
    vb.net 打字练习
    unsigned int 与 unsigned long 一样吗?
    epoll使用详解(精髓)
    论epoll的使用 高调coding,低调做人 C++博客
    学习使用epoll The time is passing ITeye技术网站
    ubuntu下sed命令详解 Dicky 开源中国社区
    分享:jquery遍历之children()与find()的区别
  • 原文地址:https://www.cnblogs.com/wnarutou/p/2732861.html
Copyright © 2020-2023  润新知