如何根据屏幕分辨率重新定位对话框 [英] How to repositioned dialog based on screen resolution

查看:100
本文介绍了如何根据屏幕分辨率重新定位对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个有很多对话框的应用程序。我最初在主/父对话框上定位了对话框。每当屏幕分辨率发生变化时,我都会捕获WM_SETTINGCHANGE处理程序中的坐标。在更改屏幕分辨率时,此处理程序计算当前坐标,但是为了在适当的位置显示对话框,我需要关闭对话框并再次重新打开它,在OnInitdialog中它获取新的坐标并重新定位窗口。但是我想要在屏幕分辨率发生变化时重新定位对话框。我试图在chiled对话框中捕获WM_SETTINGCHANGE,但是当屏幕分辨率改变时,这个处理程序不会被调用。

请告诉我如何在屏幕分辨率发生变化时向子对话框发送消息以重新定位?

I have an application which has many dialogs. I have positioned dialogs on main / parent dialog initially. Whenever there is a change in screen resolution I have capture the co-ordinates in WM_SETTINGCHANGE handler. While changing the screen resolution this handler calculates the current co-ordinates but to show the dialog in proper place I need to close he dialog and reopen it again where in OnInitdialog it gets the new co-ordinates and re-position the window. But I want that dialog shd be re-positioned whenever there is a change in screen resolution. I tried to capture WM_SETTINGCHANGE in chiled dialog but this handler doesn''t get called when screen resolution changes.
Pls let me know how to send message to child dialog to re-position whenever there is a change in screen resolution?

推荐答案

来自在主窗口的 WM_SETTINGCHANGE 处理程序中,您可以使用 SendMessageToDescendants [ ^ ]。
From within the WM_SETTINGCHANGE handler of your main window you can send this message (or a user defined one) to all descendant windows using SendMessageToDescendants[^].


这篇关于如何根据屏幕分辨率重新定位对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆