MFC window move, top, floating effect

Source: Internet
Author: User

voidCmfcmovewindowdlg::onbnclickedbutton1 () {// LeftCRect Rec; GetWindowRect (&rec); Rec.left-=M_imove; Rec.right-=M_imove; MoveWindow (&rec); }voidCmfcmovewindowdlg::onbnclickedbutton3 () {// RightCRect Rec; GetWindowRect (&rec); Rec.left+=M_imove; Rec.right+=M_imove; MoveWindow (&rec); }voidCmfcmovewindowdlg::onbnclickedbutton2 () {// upCRect Rec; GetWindowRect (&rec); Rec.top-=M_imove; Rec.bottom-=M_imove; MoveWindow (&rec); }voidCmfcmovewindowdlg::onbnclickedbutton4 () {// DownCRect Rec; GetWindowRect (&rec); Rec.top+=M_imove; Rec.bottom+=M_imove; MoveWindow (&rec); }voidcmfcmovewindowdlg::onenchangeedit1 () {//TODO: If the control is a RICHEDIT control, it will not//send this notification unless overriding CDialog::OnInitDialog ()//function and call CRichEditCtrl (). SetEventMask (),//The enm_change flag "or" is also calculated into the mask. M_imove=Getdlgitemint (IDC_EDIT1);}voidcmfcmovewindowdlg::onbnclickedbutton5 () {if(!M_btopwindow) {:: SetWindowPos (M_hwnd, Hwnd_topmost,0,0,0,0, Swp_nomove|swp_nosize); Setdlgitemtext (Idc_button5,"Cancel"); }    Else{:: SetWindowPos (M_hwnd, Hwnd_notopmost,0,0,0,0, Swp_nomove|swp_nosize); Setdlgitemtext (Idc_button5,"Settopwindow"); } M_btopwindow= !M_btopwindow;}

voidCmfcmovewindowdlg::onbnclickedbutton6 () {if(!m_bcreate) {M_bcreate= !m_bcreate;            M_dlgshow.create (Idd_dialog1, NULL); } m_dlgshow.showwindow (Sw_show);}//SubDlg.cppBOOL Cdiashow::oninitdialog () {cdialog::oninitdialog (); //Get Desktop sizeCRect Rectworkarea; SystemParametersInfo (Spi_getworkarea,0, &Rectworkarea, Spif_sendchange); //Get dialog box sizeCRect Rectdlg; GetWindowRect (&Rectdlg); //Set the window to the lower-right corner:: SetWindowPos (M_hwnd, Hwnd_bottom, Rectworkarea.right-rectdlg.width (), Rectworkarea.bottom-rectdlg.height (), Rectdlg.width (), Rectdlg.height (), swp_nozorder); //Floating Effect:: AnimateWindow (M_hwnd, +, aw_ver_negative|aw_slide); returnTRUE;//return TRUE Unless you set the focus to a control//Exception: OCX property page should return FALSE}

MFC window move, top, floating effect

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.