Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I lock the width or height of an MFC dialog during resizing?

Is there a way to lock a dialog box's size in one direction (restrict only width or only height) in MFC?

like image 733
Daryna Avatar asked Mar 10 '11 11:03

Daryna


1 Answers

You need to override OnGetMinMaxInfo. In OnInitDialog you can capture the current height, and then use it for both minimum and maximum height. Call __super::OnGetMinMaxInfo first and then only change the height members. Note that the window may not exist the first couple times OnGetMinMaxInfo are called.

Here's a detailed article on GetMinMaxInfo.

like image 82
Aidan Ryan Avatar answered Oct 03 '22 17:10

Aidan Ryan