Void cdistortdlg: onpaint () { Cpaintdc DC (this ); If (isiconic ()) { // Device context for paintingSendmessage (wm_iconerasebkgnd, (wparam) DC. getsafehdc (), 0 ); // Center icon in client rectangle Int cxicon = getsystemmetrics (sm_cxicon ); Int cyicon = getsystemmetrics (sm_cyicon ); Crect rect; Getclientrect (& rect ); Int x = (rect. Width ()-cxicon + 1)/2; Int y = (rect. Height ()-cyicon + 1)/2; // Draw the icon DC. drawicon (X, Y, m_hicon ); } Else { // Add By Myself --------------------------------------------------- DC. selectstockobject (null_pen); // draw an elliptic without edges // Obtain the size of the customer Zone Crect rect; Getclientrect (rect ); Cbrush * pbrushold; Cbrush brushnew; // Define the paint brush, where you can change the color Brushnew. createsolidbrush (RGB (204,255, 66 )); // Select a paint brush as a drawing device Pbrushold = Dc. SelectObject (& brushnew ); // Draw an ellipse DC. ellipse (rect ); // Restore and release the paint brush DC. SelectObject (pbrushold ); Brushnew. deleteobject (); } } // Write the following function to support any form. Hcursor cdistortdlg: onquerydragicon () { Return (hcursor) m_hicon; } Uint cdistortdlg: onnchittest (cpoint point) { Uint nhittest = cdialog: onnchittest (point ); Return (nhittest = htclient )? Htcaption: nhittest; } // Write the real number of the timer below // If you want the result to be round after N changes, set this value to 1.035 # Define multi 1.1 Void cdistortdlg: ontimer (uint nidevent) { Static ncount = 0; // number of changes to the form, increasing by 1 each time Static border = 1; // It indicates to increase or decrease Static double dmulti = 1; // form change multiple Crect rectwnd; Cpoint ptmiddle, pttopleft, ptbtmright; // Confirm the form region Center Ptmiddle = m_rectwnd.centerpoint (); // Handle various scheduled events in different situations Switch (nidevent) { Case event_redraw: Ncount ++; If (border = 1) {// Larger Dmulti * = multi; } Else {// Indicates smaller Dmulti/= multi; } // Determine the rectangle size of the form Pttopleft. x = (long) (ptmiddle. x-m_rectWnd.Width ()/(2 * dmulti )); Pttopleft. Y = (long) (ptmiddle. y-m_rectWnd.Height ()/2 ); Ptbtmright. x = (long) (ptmiddle. x + m_rectwnd.width ()/(2 * dmulti )); Ptbtmright. Y = (long) (ptmiddle. Y + m_rectwnd.height ()/2 ); Rectwnd. setrect (pttopleft, ptbtmright ); // Release the object M_rgn.detach (); // Create an elliptical Region M_rgn.createellipticrgn (pttopleft. X, pttopleft. Y, ptbtmright. X, ptbtmright. y ); Setjavaswrgn (hrgn) m_rgn, true ); If (ncount = 10) // sets the number of changes. This is 10 times. { Ncount = 0; Border = (border = 1 )? -; // Reverse changes after 10 times } Break; } Cdialog: ontimer (nidevent ); } |