This class is quite simple, so I only post the source code completely.
If necessary, I will make a corresponding description.
============================================================================================================================================================================================================= ============
* Description: * * 1. Name space: APC_ANIWINDOW * Class Name: AniWindow * * 2. Declaration: AniWindow A = New AniWindow (this.handle, 100, 1, this); * * 3. Parameter description: AniWindow (window handle , Animated style, open or close flag, instance form); * Window handle: this.handle * Animation style: 0-> Normal display * 1 -> From left to right display * 2 -> from right to left * 3 - > From top to bottom * 4-> From bottom to top display * 5 -> Transparent gradient display * 6 -> from the middle four weeks * 7 -> left upper corner * 8-> Left lower corner * 9-> upper right corner Stretch * 10-> Right corner stretch * switch logo: 0 to turn off window 1 to open window * instance form: To remove the BUG of Label, this * * =============== ======================================================== * * Another need to say, I only know how visible Label on Form, I will have something to solve. * But I don't know if there is any other controls to trigger an error, * * Also, if Is the label on the form, the program will be set to not visual, if it is Panel .... x_x or wrong. * So, if there is label in your program, or in Panel, then you have to Write the code to achieve the visual inevitable, ... * ******************************************** ************************************** / Using system; use system.windows.forms; namespace apc_aniwindow {///
/// summary> public class AniWindow {[System.Runtime.InteropServices.DllImport ( "user32")] private static extern bool AnimateWindow (IntPtr hwnd, int dwTime, int dwFlags); private const int AW_HOR_POSITIVE = 0x0001; private const int AW_HOR_NEGATIVE = 0x0002; private const int AW_VER_POSITIVE = 0x0004; private const int AW_VER_NEGATIVE = 0x0008; private const int AW_CENTER = 0x0010; private const int AW_HIDE = 0x10000; private const int AW_ACTIVATE = 0x20000; private const int AW_SLIDE = 0x40000; private const int AW_BLEND = 0x80000; private int CloseOpen = 0x20000; public AniWindow (IntPtr hwnd, int dwFlags, int CloseOrOpen, System.Windows.Forms.Form myform) {try {if (CloseOrOpen == 1) {foreach (System.Windows.Forms. Control mycontrol in myform.controls) {string m = mycontrol.gettype (). Tostring (); m = m.substring (m == "label") {myControl.visible = false; / / Here, before the animation effect, set the Label visible on the form to an invisible}}} // Opened or off 0 is closed 1 Yes Open if (closeoropen == 0) {closeopen = 0x10000;} if (dwflags == 100) {INT ZZ = 10; Random a = new random (); dwflags = (int) a.next (zz);} switch (dwflags) {case 0: // Normal display AnimateWindow (HWND, 200, AW_ACTIVATE); Break; Case 1: // Displays AnimateWindow from left to right (hwnd, 200, aw_hor_positive | closeopen); Break; Case 2: // Display animateWindow from right to left; Break; Case 3: // Displays AnimateWindow from top to bottom (HWND, 200, AW_VER_POTINIVE | Closeopen; Break; Case 4: // From below Display AnimateWindow (HWND, 200, AW_VER_NEGATIVE | CloseOpen); Break;
Case 5: // Transparent gradient Displays AnimateWindow (hwnd, 200, aw_blend | closeopen); Break; Case 6: // From the middle four-week AnimateWindow (hwnd, 200, aw_center | closeopen); Break; Case 7: // Left upper corner stretch AnimateWindow (hwnd, 200, AW_SLIDE | AW_HOR_POSITIVE | AW_VER_POSITIVE | CloseOpen); break; case 8: // bottom left extension AnimateWindow (hwnd, 200, AW_SLIDE | AW_HOR_POSITIVE | AW_VER_NEGATIVE | CloseOpen); break; case 9: // top right stretch AnimateWindow (hwnd, 200, AW_SLIDE | AW_HOR_NEGATIVE | AW_VER_POSITIVE | CloseOpen); break; case 10: // bottom right stretch AnimateWindow (hwnd, 200, AW_SLIDE | AW_HOR_NEGATIVE | AW_VER_NEGATIVE | CloseOpen); break;} if (CloseOrOpen == 1 ) {FOREACH (System.Windows.Form.Controls) {string m = myControl.gettype (). Tostring (); m = m.substring (m.length-5); if (m == " Label ") {MyControl.visible = true; // Here, restore Label's visual.
Or directly in the code, you can use it.
Welcome to communicate.
In addition, I use form's Region attribute, and I have made a normal animation example, but there is no API effect, (but absolutely no bug, such as Label is wrong)
But unfortunately, a specified form's Region, when the form changes to the size, also reset it, Region
Hey ..... I don't know what is good .. Better way .....