Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Center a CFormView "dialog resource" within the CMainFrame window in a SDI

Tags:

mfc

sdi

I have a dialog resource with some controls inside, mostly a user and password edit controls, bonded to a CFormView. Such dialog is a small rectangle of 300 x 200 pixels.

When I run the application, the CFrameWindow occupies almost all screen, so the dialog shows in top-left corner. If I try to get the rectangle dimension of CFormView, I found that it has been expanded to visible area in CMainFrame, no matter the original dialog size.

What I currently get

My question is whether is possible to keep the dialog (the CFormView) centred in the middle of the CMainFrame, and keep always centred even if the ON_SIZE message is called.

What I want

Thank you.

like image 822
Pablo Avatar asked Dec 28 '25 16:12

Pablo


1 Answers

In VS2019 you don't have to write any line of code. The rc Editor has the dynamic layout function capabilities. Place the controls exactly in the middle of the dialog. Then set the

enter image description here

like image 86
Tom Tom Avatar answered Dec 31 '25 18:12

Tom Tom



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!