Animation pop-up and animation blanking of dialog

xiaoxiao2021-04-10  361

In the Windows application, the dialog is the most widely used, which is also more difficult to control its style (external table). I believe that friends who have used Windows are enjoying their powerful feature, they must also sigh with the stereoscopic interface it provides. Typically, the pop-ups and blanks of the dialog box are instantaneous. Here, how to implement the animation pop-ups and blanking, enhanced procedures of the dialog box. Please implement it as follows: Step 1: Generate our engineering (Based on dialog) FlashDLG, all options take the default value, add several controls to the dialog box.

Step 2: Define the following variables in the class header file of the dialog, as follows: CPoint Point; int NWidth, NHEIGHT; INT DX, DY; INT DX1, DY1; Step 3: Add the following code in OnInitDialog (): Bool CFlashDlgDlg :: OnInitDialog () {CDialog :: OnInitDialog (); CRect dlgRect; GetWindowRect (dlgRect); CRect desktopRect; GetDesktopWindow () -> GetWindowRect (desktopRect); MoveWindow ((desktopRect.Width () - dlgRect.Width ()) / 2 (DesktopRect.Height () - DLGRECT.HEIGHT () / 2, 0, 0); NWIDTH = DLGRECT.WIDTH (); NHEIGHT = DLGRECT.HEIGHT (); DX = 2; DY = 4; DX1 = 2; DY1 = 2; settimer (1, 10, null); Return True;} Fourth step: Add the ONTIMER function, add the following code: void cflashdlgdlg :: Ontimer (uint nidEvent) {// Todo: add your message handler code here and / or call default CRect dlgRect; GetWindowRect (dlgRect); CRect desktopRect; GetDesktopWindow () -> GetWindowRect (desktopRect); if (nIDEvent == 1) {MoveWindow ((-dx desktopRect.Width () - dlgRect.Width ()) / 2 (-dy desktopRect.Height () - DLGRECT.HEIGHT ()) / 2, DX DLGRECT.WIDTH (), DY DLGRECT.HEIGHT ()); if (DLGRect.width > = NWIDT h) DX = 0; // do not overgrowness> = NHEight) DY = 0; // do not overgrowiff ((DLGRect.Width ()> = nwidth && (DLGRect.height ()> = NHEIGHT) KillTimer (1); // stop the timer} IF ((DLGRect.Width ()> = nwidth) && (DLGRect.Height ()> = nHEight)) KillTimer (1); // stop Timer if (nidevent == 2) {MoveWindow (( DX DesktopRect.width () - DLGRECT.WIDTH ()) / 2 ( DY DesktopRect.Height () - DLGRect.Height ()) / 2, -DX1 DLGRECT.WIDTH (),-Dy1 DLGRect.Height ()); if (DLGRect.width () <= 0) DX1 = 0;

转载请注明原文地址:https://www.9cbs.com/read-133452.html

New Post(0)