Set the dialog box display position

Source: Internet
Author: User

Chipdlg is the idd_hip_dialog class.  Chipdlg * m_hipdlg; // define it first

M_hipdlg = new chipdlg (this );

M_hipdlg-> Create (idd_hip_dialog, this); // create dialog box

Crect rcdlgs;
M_hipdlg-> getwindowrect (rcdlgs); // obtain the rect dialog box size.
Screentoclient (rcdlgs); // convert the screen value to the actual value.

 

Int Cx = getsystemmetrics (sm_cxscreen); // obtain the screen resolution
Int Cy = getsystemmetrics (sm_cyscreen );

 

CX Cy is the value of X and Y in the bottom right corner of the screen.

 

// M_hipdlg-> movewindow (cx-rcDlgs.Width (), cy-rcDlgs.Height (), rcdlgs. Width (), rcdlgs. Height (), true );//

 

// The first two parameters of movewindow are the position X and Y of the dialog box.

// The three or four items are the size of the dialog box!


M_hipdlg-> setwindowpos (& wndtopmost, cx-rcDlgs.Width (), cy-rcDlgs.Height (), rcdlgs. Width (), rcdlgs. Height (), swp_nosize );

 

// Setwindowpos is the first one that I wrote to top the dialog box. If necessary, I will not elaborate on it.

// The last four are the same as those of movewindow.

 

// The last one is the attribute that I entered so that it cannot be changed. There are many attributes, but nomove cannot be entered. No // It cannot be moved !!!

 

Select one for movewindow and setwindowpos. The latter is recommended.

M_hipdlg-> showwindow (sw_show );


Okay, the dialog box is in the lower right corner. If it is in the upper left corner

M_hipdlg-> setwindowpos (& wndtopmost, 0,0, rcdlgs. Width (), rcdlgs. Height (), swp_nosize );

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.