关于MFC下的窗口风格问题。。。

sup_ace 2013-06-12 07:02:41
我想实现类似win7选择无线网络那个小窗口的风格。有一圈边框,无标题栏,不可伸缩大小(不可以改变窗口大小),这么应该怎么设置窗口风格?
我用Border 下的 Resizing属性 感觉效果最为接近。但是鼠标放在边缘的时候,鼠标变为可拖拽的箭头,可以改变窗口大小?我应该去小那个对应的属性呢?或者怎么设置风格才能实现类似于无线网络选择的那个窗口风格呢?
...全文
205 20 打赏 收藏 转发到动态 举报
写回复
用AI写文章
20 条回复
切换为时间正序
请发表友善的回复…
发表回复
sup_ace 2013-06-16
  • 打赏
  • 举报
回复
引用 18 楼 tiger9991 的回复:
我用的是单文档应用来测试的,没用Dialog。单文档效果完全和楼主要求的符合。 直接ModifyStyle(WS_CAPTION,0)就可以了。
又回去试了试 对于对话框 想要实现我上面说的效果 可以将窗口border属性设置为Resizing 但是此时鼠标可以调整窗口大小 为了使窗口固定我们可以通过让 WM_NCHITTEST 直接返回来实现 参考:http://blog.csdn.net/ljfth/article/details/6955800 http://blog.csdn.net/zhuimengzh/article/details/6977733
sup_ace 2013-06-14
  • 打赏
  • 举报
回复
引用 18 楼 tiger9991 的回复:
我用的是单文档应用来测试的,没用Dialog。单文档效果完全和楼主要求的符合。 直接ModifyStyle(WS_CAPTION,0)就可以了。
回去再试试
傻X 2013-06-14
  • 打赏
  • 举报
回复
我用的是单文档应用来测试的,没用Dialog。单文档效果完全和楼主要求的符合。 直接ModifyStyle(WS_CAPTION,0)就可以了。
sup_ace 2013-06-14
  • 打赏
  • 举报
回复
引用 14 楼 tiger9991 的回复:
为啥我就可以?我都测试过了 你是在OnCreate函数中: 使用ModifyStyle(WS_CAPTION,0)的么?
啊 不是 我是在对话框的初始化函数里面使用的OnInitDialog() ModifyStyle(WS_CAPTION,0) ModifyStyle(0,WS_BORDER)
sup_ace 2013-06-14
  • 打赏
  • 举报
回复
引用 14 楼 tiger9991 的回复:
为啥我就可以?我都测试过了 你是在OnCreate函数中: 使用ModifyStyle(WS_CAPTION,0)的么?
恩 是的 那一开始改选择什么bonder属性呢?默认的还是none?resizing?
worldy 2013-06-14
  • 打赏
  • 举报
回复
定义你自己版本的CWnd::PreCreateWindow函数 修改cs参数的窗口风格: Extended Window Styles WS_EX_ACCEPTFILES Specifies that a window created with this style accepts drag-and-drop files. WS_EX_CLIENTEDGE Specifies that a window has a 3D look — that is, a border with a sunken edge. WS_EX_CONTEXTHELP Includes a question mark in the title bar of the window. When the user clicks the question mark, the cursor changes to a question mark with a pointer. If the user then clicks a child window, the child receives a WM_HELP message. WS_EX_CONTROLPARENT Allows the user to navigate among the child windows of the window by using the TAB key. WS_EX_DLGMODALFRAME Designates a window with a double border that may (optionally) be created with a title bar when you specify the WS_CAPTION style flag in the dwStyle parameter. WS_EX_LEFT Gives window generic left-aligned properties. This is the default. WS_EX_LEFTSCROLLBAR Places a vertical scroll bar to the left of the client area. WS_EX_LTRREADING Displays the window text using left-to-right reading order properties. This is the default. WS_EX_MDICHILD Creates an MDI child window. WS_EX_NOPARENTNOTIFY Specifies that a child window created with this style will not send the WM_PARENTNOTIFY message to its parent window when the child window is created or destroyed. WS_EX_OVERLAPPEDWINDOW Combines the WS_EX_CLIENTEDGE and WS_EX_WINDOWEDGE styles WS_EX_PALETTEWINDOW Combines the WS_EX_WINDOWEDGE and WS_EX_TOPMOST styles. WS_EX_RIGHT Gives a window generic right-aligned properties. This depends on the window class. WS_EX_RIGHTSCROLLBAR Places a vertical scroll bar (if present) to the right of the client area. This is the default. WS_EX_RTLREADING Displays the window text using right-to-left reading order properties. WS_EX_STATICEDGE Creates a window with a three-dimensional border style intended to be used for items that do not accept user input. WS_EX_TOOLWINDOW Creates a tool window, which is a window intended to be used as a floating toolbar. A tool window has a title bar that is shorter than a normal title bar, and the window title is drawn using a smaller font. A tool window does not appear in the task bar or in the window that appears when the user presses ALT+TAB. WS_EX_TOPMOST Specifies that a window created with this style should be placed above all nontopmost windows and stay above them even when the window is deactivated. An application can use the SetWindowPos member function to add or remove this attribute. WS_EX_TRANSPARENT Specifies that a window created with this style is to be transparent. That is, any windows that are beneath the window are not obscured by the window. A window created with this style receives WM_PAINT messages only after all sibling windows beneath it have been updated. WS_EX_WINDOWEDGE Specifies that a window has a border with a raised edge.
傻X 2013-06-14
  • 打赏
  • 举报
回复
为啥我就可以?我都测试过了 你是在OnCreate函数中: 使用ModifyStyle(WS_CAPTION,0)的么?
「已注销」 2013-06-14
  • 打赏
  • 举报
回复
在 Windows 7 上测试了一下,指定样式 WS_CHILD|WS_THICKFRAME|WS_VISIBLE 即可创建这样一个窗口。由于其包含 WS_CHILD 样式,所以必须指定一个有效的父窗口句柄,否则无法创建。另外,WS_THICKFRAME 使得该窗口可以调整大小,但是你可以处理 WM_SIZING 禁止更改大小。如果你既不想让他不可调整,又能达到效果,我是没找到什么方法。
sup_ace 2013-06-13
  • 打赏
  • 举报
回复
有木有 有什么高招想法的 求大神指导
sup_ace 2013-06-13
  • 打赏
  • 举报
回复
引用 9 楼 tiger9991 的回复:
cs.style 去掉WS_CAPTION,保留WS_BORDER
谢了版主 回去了试试 现在用的xp
傻X 2013-06-13
  • 打赏
  • 举报
回复
cs.style 去掉WS_CAPTION,保留WS_BORDER
sup_ace 2013-06-13
  • 打赏
  • 举报
回复
引用 9 楼 tiger9991 的回复:
cs.style 去掉WS_CAPTION,保留WS_BORDER
版主大大 好像不行啊
sup_ace 2013-06-13
  • 打赏
  • 举报
回复
引用 6 楼 tiger9991 的回复:
为啥用resizing风格,不是有个None风格的嘛?
那样不就没有哪个透明边框了么?
sup_ace 2013-06-13
  • 打赏
  • 举报
回复
引用 5 楼 woshisange03 的回复:
就是一个dialog把titlebar去掉,把resizing去掉啊。不就是没标题不能拉动大小了吗???
但是那样不就没有哪个透明边框了么
傻X 2013-06-13
  • 打赏
  • 举报
回复
为啥用resizing风格,不是有个None风格的嘛?
woshisange03 2013-06-13
  • 打赏
  • 举报
回复
就是一个dialog把titlebar去掉,把resizing去掉啊。不就是没标题不能拉动大小了吗???
woshisange03 2013-06-13
  • 打赏
  • 举报
回复
菜鸟路过,友情帮顶
sup_ace 2013-06-13
  • 打赏
  • 举报
回复
顶起来。。。。
sup_ace 2013-06-12
  • 打赏
  • 举报
回复
木有人知道么?求大神啊
sup_ace 2013-06-12
  • 打赏
  • 举报
回复
引用

希望实现这种窗口风格。不可拖拽 无标题栏 但是有边框

15,979

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧