Winform animation display form

Source: Internet
Author: User

Frm_main.cs

View code

 1   Using System;
2 Using System. Collections. Generic;
3 Using System. componentmodel;
4 Using System. Data;
5 Using System. drawing;
6 Using System. text;
7 Using System. Windows. forms;
8 Using System. runtime. interopservices;
9
10 Namespace Cartoonform
11 {
12 Public Partial Class Frm_main: Form
13 {
14 Public Const Int32 aw_hor_positive = Zero X 00000001 ;
15 Public Const Int32 aw_hor_negative = Zero X 00000002 ;
16 Public Const Int32 aw_ver_positive =Zero X 00000004 ;
17 Public Const Int32 aw_ver_negative = Zero X 00000008 ;
18 Public Const Int32 aw_center = Zero X 00000010 ;
19 Public Const Int32 aw_hide = Zero X 00010000 ;
20 Public Const Int32 aw_activate = Zero X 00020000 ;
21 Public Const Int32 aw_slide = Zero X 00040000 ;
22 Public Const Int32 aw_blend = Zero X 00080000 ;
23 Public Frm_main ()
24 {
25 Initializecomponent ();
26 Animatewindow ( This . Handle, 3000 , Aw_slide + aw_ver_negative ); // Start form Animation
27 }
28
29 // Rewrite the API function to execute the form animation display operation.
30 [Dllimportattribute ( " User32.dll " )]
31 Private Static Extern Bool Animatewindow (intptr hwnd, Int Dwtime, Int Dwflags );
32
33 Private Void Form1_formclosed ( Object Sender, formclosedeventargs E)
34 {
35 Animatewindow ( This . Handle, 3000 , Aw_slide + aw_ver_negative + aw_hide ); // End form Animation
36 }
37 }
38 }

Frm_main.designer.cs

View code

 1   Namespace Cartoonform
2 {
3 Partial Class Frm_main
4 {
5 /// <Summary>
6 /// Required designer variables.
7 /// </Summary>
8 Private System. componentmodel. icontainer components = Null ;
9
10 /// <Summary>
11 /// Clear all resources in use.
12 /// </Summary>
13 /// <Param name = "disposing"> If the managed resources should be released, the value is true; otherwise, the value is false. </Param>
14 Protected Override Void Dispose ( Bool Disposing)
15 {
16 If (Disposing & (components! = Null ))
17 {
18 Components. Dispose ();
19 }
20 Base . Dispose (disposing );
21 }
22
23 # Region The Code
24
25 /// <Summary>
26 /// Required methods supported by the designer-do not
27 /// Use the code editor to modify the content of this method.
28 /// </Summary>
29 Private Void Initializecomponent ()
30 {
31 This . Picturebox1 = New System. Windows. Forms. picturebox ();
32 (System. componentmodel. isupportinitialize )( This . Picturebox1). begininit ();
33 This . Suspendlayout ();
34 //
35 // Picturebox1
36 //
37 This . Picturebox1.dock = system. Windows. Forms. dockstyle. Fill;
38 This . Picturebox1.image = Global : Cartoonform. properties. Resources. _ 03;
39 This . Picturebox1.location = New System. Drawing. Point ( 0 , 0 );
40 This . Picturebox1.name = " Picturebox1 " ;
41 This . Picturebox1.size = New System. Drawing. Size ( 377 , 276 );
42 This . Picturebox1.sizemode = system. Windows. Forms. pictureboxsizemode. stretchimage;
43 This . Picturebox1.tabindex =0 ;
44 This . Picturebox1.tabstop = False ;
45 //
46 // Form1
47 //
48 This . Autoscaledimensions =New System. Drawing. sizef (6f, 12f );
49 This . Autoscalemode = system. Windows. Forms. autoscalemode. Font;
50 This . Clientsize = New System. Drawing. Size ( 377 , 276 );
51 This . Controls. Add ( This . Picturebox1 );
52 This . Name = " Form1 " ;
53 This . Text = " Animation display form " ;
54 This . Formclosed + = New System. Windows. Forms. formclosedeventhandler ( This . Form1_formclosed );
55 (System. componentmodel. isupportinitialize )( This . Picturebox1). endinit ();
56 This . Resumelayout ( False );
57
58 }
59
60 # Endregion
61
62 Private System. Windows. Forms. picturebox picturebox1;
63 }
64 }

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.