How to make a dialog as same size as another dialog in MFC?
I am in process of creating开发者_JAVA技巧 a dialog IDD_DIALOG2 which i want to be in the same size as existing dialog IDD_DIALOG1, what would be the easiest way to do this in VC++?
Just resize in design view. The dialog's size shows up in the status bar.
(you could also edit the .rc file and copy the 4 numbers that follow the dialog's ID)
The sane way would be to look up the IDD_DIALOG1's dialog definition and use the same sizes.
If you don't have access to IDD_DIALOG1's dialog definition, you could bring up IDD_DIALOG1, use GetWindowRect() on it to record its actual size, close it, open IDD_DIALOG2, and then use MoveWindow() to resize to the same size. Not generally recommended, but it's possible.
It's possible to copy & paste the dialog in the Resource View - all the controls come with it also.
精彩评论