Animation start window class (source code)

xiaoxiao2021-03-05  21

This class is quite simple, so I only post the source code completely. If necessary, I will make a corresponding explanation. ======================== ============================================== * 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, animation style, open or close flag, instance form * Window handle: this.handle * Animation style: 0-> Normal display * 1 -> From left to right, display * 3 -> from top to bottom * 4 -> Show * 5-> Transparent gradient display * 6-> from the middle to four weeks * 7 -> left upper corner * 8-> upper left corner stretch * 9-> upper right corner stretch * 10-> upper right corner stretch * switch logo : 0 To the Close Window 1 to Open Window * Instance Form: In order to remove the BUG of Label, value this * * ========================= ======================================================================================================================================================================================== When there is visible label on Form, it will be resolved. * But I don't know if there is any other control that will trigger an error, * * Also, if it is the Label on the form, the program will automatically set it to Not visible, if it is Panel .... x_x will still be wrong. * So, if there is label in your program, or in Panel, then you have to write code to implement the visuality. ********************************************************** ***************** / Using System; use system.windows.forms; Namespace APC_AniWindow {///

/// Class1 summary description.

/// 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;

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

New Post(0)