home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 July / CMCD0704.ISO / Software / Freeware / Grafica / Animation / AnimationStudioSetup.msi / _3CA7015D32004C8B8FAB422593C47FB8 / _1EAAC8144BD160C6362DABED629B9A24 < prev    next >
Text File  |  2004-05-24  |  15KB  |  413 lines

  1. using System;
  2. using System.Drawing;
  3. using System.Collections;
  4. using System.ComponentModel;
  5. using System.Windows.Forms;
  6. using System.Data;
  7.  
  8. namespace Tutorial_2
  9. {
  10.     /// <summary>
  11.     /// Summary description for Form1.
  12.     /// </summary>
  13.     public class Form1 : System.Windows.Forms.Form
  14.     {
  15.         private AnimationStudio.SpritePanel spritePanel1;
  16.         private System.Windows.Forms.RichTextBox richTextBox1;
  17.         private AnimationStudio.Sprite sprite1;
  18.         private AnimationStudio.KeyFrame keyFrame1;
  19.         private AnimationStudio.KeyFrame keyFrame2;
  20.         private AnimationStudio.KeyFrame keyFrame3;
  21.         private AnimationStudio.KeyFrame keyFrame4;
  22.         private AnimationStudio.Sprite sprite2;
  23.         private AnimationStudio.KeyFrame keyFrame5;
  24.         private AnimationStudio.KeyFrame keyFrame6;
  25.         private AnimationStudio.Sprite sprite3;
  26.         private AnimationStudio.KeyFrame keyFrame7;
  27.         private AnimationStudio.KeyFrame keyFrame8;
  28.         private AnimationStudio.Sprite sprite4;
  29.         private AnimationStudio.KeyFrame keyFrame9;
  30.         private AnimationStudio.KeyFrame keyFrame10;
  31.         private AnimationStudio.KeyFrame keyFrame11;
  32.         private AnimationStudio.KeyFrame keyFrame12;
  33.         private AnimationStudio.KeyFrame keyFrame13;
  34.         /// <summary>
  35.         /// Required designer variable.
  36.         /// </summary>
  37.         private System.ComponentModel.Container components = null;
  38.  
  39.         public Form1()
  40.         {
  41.             //
  42.             // Required for Windows Form Designer support
  43.             //
  44.             InitializeComponent();
  45.  
  46.             //
  47.             // TODO: Add any constructor code after InitializeComponent call
  48.             //
  49.         }
  50.  
  51.         /// <summary>
  52.         /// Clean up any resources being used.
  53.         /// </summary>
  54.         protected override void Dispose( bool disposing )
  55.         {
  56.             if( disposing )
  57.             {
  58.                 if (components != null) 
  59.                 {
  60.                     components.Dispose();
  61.                 }
  62.             }
  63.             base.Dispose( disposing );
  64.         }
  65.  
  66.         #region Windows Form Designer generated code
  67.         /// <summary>
  68.         /// Required method for Designer support - do not modify
  69.         /// the contents of this method with the code editor.
  70.         /// </summary>
  71.         private void InitializeComponent()
  72.         {
  73.             System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
  74.             AnimationStudio.Sound sound1 = new AnimationStudio.Sound();
  75.             AnimationStudio.Sound sound2 = new AnimationStudio.Sound();
  76.             AnimationStudio.Sound sound3 = new AnimationStudio.Sound();
  77.             AnimationStudio.Sound sound4 = new AnimationStudio.Sound();
  78.             this.spritePanel1 = new AnimationStudio.SpritePanel();
  79.             this.richTextBox1 = new System.Windows.Forms.RichTextBox();
  80.             this.sprite1 = new AnimationStudio.Sprite(this.spritePanel1);
  81.             this.keyFrame1 = new AnimationStudio.KeyFrame();
  82.             this.keyFrame2 = new AnimationStudio.KeyFrame();
  83.             this.keyFrame3 = new AnimationStudio.KeyFrame();
  84.             this.keyFrame4 = new AnimationStudio.KeyFrame();
  85.             this.sprite2 = new AnimationStudio.Sprite(this.spritePanel1);
  86.             this.keyFrame5 = new AnimationStudio.KeyFrame();
  87.             this.keyFrame6 = new AnimationStudio.KeyFrame();
  88.             this.sprite3 = new AnimationStudio.Sprite(this.spritePanel1);
  89.             this.keyFrame7 = new AnimationStudio.KeyFrame();
  90.             this.keyFrame8 = new AnimationStudio.KeyFrame();
  91.             this.sprite4 = new AnimationStudio.Sprite(this.spritePanel1);
  92.             this.keyFrame9 = new AnimationStudio.KeyFrame();
  93.             this.keyFrame10 = new AnimationStudio.KeyFrame();
  94.             this.keyFrame11 = new AnimationStudio.KeyFrame();
  95.             this.keyFrame12 = new AnimationStudio.KeyFrame();
  96.             this.keyFrame13 = new AnimationStudio.KeyFrame();
  97.             this.spritePanel1.SuspendLayout();
  98.             this.SuspendLayout();
  99.             // 
  100.             // spritePanel1
  101.             // 
  102.             this.spritePanel1.BackColor = System.Drawing.Color.DarkGray;
  103.             this.spritePanel1.Controls.Add(this.richTextBox1);
  104.             this.spritePanel1.Location = new System.Drawing.Point(8, 8);
  105.             this.spritePanel1.Name = "spritePanel1";
  106.             this.spritePanel1.Size = new System.Drawing.Size(672, 520);
  107.             this.spritePanel1.Sprites.AddRange(new AnimationStudio.Sprite[] {
  108.                                                                                 this.sprite1,
  109.                                                                                 this.sprite2,
  110.                                                                                 this.sprite3,
  111.                                                                                 this.sprite4});
  112.             this.spritePanel1.TabIndex = 0;
  113.             // 
  114.             // richTextBox1
  115.             // 
  116.             this.richTextBox1.BackColor = System.Drawing.Color.LightSkyBlue;
  117.             this.richTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
  118.             this.richTextBox1.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
  119.             this.richTextBox1.ForeColor = System.Drawing.Color.Black;
  120.             this.richTextBox1.Location = new System.Drawing.Point(216, 296);
  121.             this.richTextBox1.Name = "richTextBox1";
  122.             this.richTextBox1.ReadOnly = true;
  123.             this.richTextBox1.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical;
  124.             this.richTextBox1.ShowSelectionMargin = true;
  125.             this.richTextBox1.Size = new System.Drawing.Size(448, 216);
  126.             this.richTextBox1.TabIndex = 3;
  127.             this.richTextBox1.Text = @"1) Change the properties of the Sprites, Timeline and KeyFrames
  128. 2) Watch the result of all changes in realtime in the  designer
  129. 3) Compile and run the example
  130.  
  131. Key Features of Sprites:
  132.  
  133. 1) Display as Image or Text Sprite
  134. 2) Make regions of a Sprite transparent (Transparent color)
  135. 3) Move Sprites along Path's 
  136. 4) Change Size, Rotation, Opacity, Position, Z-Order  between KeyFrames
  137. 5) Draw Borders around Sprites
  138. 4) Detect Collisions and other events (See events and Tutorial 3)
  139. 5) Change all Properties directly in the Designer without compiling
  140. 6) Play Sounds at defined Events
  141.  
  142. Open Tutorial 3";
  143.             // 
  144.             // sprite1
  145.             // 
  146.             this.sprite1.BorderColor = System.Drawing.Color.WhiteSmoke;
  147.             this.sprite1.BorderWidth = 2F;
  148.             this.sprite1.DrawBorder = false;
  149.             this.sprite1.DrawText = true;
  150.             this.sprite1.Font = new System.Drawing.Font("Arial", 30F, System.Drawing.FontStyle.Bold);
  151.             this.sprite1.Image = ((System.Drawing.Bitmap)(resources.GetObject("sprite1.Image")));
  152.             this.sprite1.PathClosed = true;
  153.             this.sprite1.Position = new System.Drawing.Point(298, 51);
  154.             this.sprite1.Rotation = 324F;
  155.             this.sprite1.Size = new System.Drawing.Size(331, 271);
  156.             sound1.SoundFile = "";
  157.             this.sprite1.Sound = sound1;
  158.             this.sprite1.Text = "Text Sprite";
  159.             this.sprite1.TextColor = System.Drawing.Color.WhiteSmoke;
  160.             this.sprite1.Timeline.AddRange(new AnimationStudio.KeyFrame[] {
  161.                                                                               this.keyFrame1,
  162.                                                                               this.keyFrame2,
  163.                                                                               this.keyFrame3,
  164.                                                                               this.keyFrame4});
  165.             this.sprite1.TransparentColor = System.Drawing.Color.Black;
  166.             this.sprite1.XScale = 1.55F;
  167.             this.sprite1.YScale = 1.55F;
  168.             // 
  169.             // keyFrame1
  170.             // 
  171.             this.keyFrame1.Duration = 60;
  172.             this.keyFrame1.Opacity = 1F;
  173.             this.keyFrame1.Position = new System.Drawing.Point(295, 234);
  174.             this.keyFrame1.Rotation = 0F;
  175.             this.keyFrame1.Visible = true;
  176.             this.keyFrame1.XScale = 1;
  177.             this.keyFrame1.YScale = 1;
  178.             this.keyFrame1.ZOrder = 0;
  179.             // 
  180.             // keyFrame2
  181.             // 
  182.             this.keyFrame2.Duration = 60;
  183.             this.keyFrame2.Opacity = 0F;
  184.             this.keyFrame2.Position = new System.Drawing.Point(646, 384);
  185.             this.keyFrame2.Rotation = 0F;
  186.             this.keyFrame2.Visible = true;
  187.             this.keyFrame2.XScale = 1;
  188.             this.keyFrame2.YScale = 1;
  189.             this.keyFrame2.ZOrder = 0;
  190.             // 
  191.             // keyFrame3
  192.             // 
  193.             this.keyFrame3.Duration = 60;
  194.             this.keyFrame3.Opacity = 1F;
  195.             this.keyFrame3.Position = new System.Drawing.Point(452, 35);
  196.             this.keyFrame3.Rotation = 0F;
  197.             this.keyFrame3.Visible = true;
  198.             this.keyFrame3.XScale = 2;
  199.             this.keyFrame3.YScale = 2;
  200.             this.keyFrame3.ZOrder = 0;
  201.             // 
  202.             // keyFrame4
  203.             // 
  204.             this.keyFrame4.Duration = 60;
  205.             this.keyFrame4.Opacity = 1F;
  206.             this.keyFrame4.Position = new System.Drawing.Point(6, 68);
  207.             this.keyFrame4.Rotation = 720F;
  208.             this.keyFrame4.Visible = true;
  209.             this.keyFrame4.XScale = 1;
  210.             this.keyFrame4.YScale = 1;
  211.             this.keyFrame4.ZOrder = 0;
  212.             // 
  213.             // sprite2
  214.             // 
  215.             this.sprite2.BorderColor = System.Drawing.Color.WhiteSmoke;
  216.             this.sprite2.BorderWidth = 2F;
  217.             this.sprite2.DrawBorder = false;
  218.             this.sprite2.DrawPath = false;
  219.             this.sprite2.DrawText = false;
  220.             this.sprite2.Font = new System.Drawing.Font("Arial", 24F, System.Drawing.FontStyle.Bold);
  221.             this.sprite2.Image = ((System.Drawing.Bitmap)(resources.GetObject("sprite2.Image")));
  222.             this.sprite2.PathClosed = true;
  223.             this.sprite2.Position = new System.Drawing.Point(32, 339);
  224.             this.sprite2.Rotation = 183.6667F;
  225.             this.sprite2.Size = new System.Drawing.Size(110, 85);
  226.             sound2.SoundFile = "";
  227.             this.sprite2.Sound = sound2;
  228.             this.sprite2.Text = "Sprite";
  229.             this.sprite2.TextColor = System.Drawing.Color.DarkRed;
  230.             this.sprite2.Timeline.AddRange(new AnimationStudio.KeyFrame[] {
  231.                                                                               this.keyFrame5,
  232.                                                                               this.keyFrame6});
  233.             this.sprite2.TransparentColor = System.Drawing.Color.Transparent;
  234.             this.sprite2.XScale = 1.033333F;
  235.             this.sprite2.YScale = 1.033333F;
  236.             // 
  237.             // keyFrame5
  238.             // 
  239.             this.keyFrame5.Duration = 100;
  240.             this.keyFrame5.Opacity = 1F;
  241.             this.keyFrame5.Position = new System.Drawing.Point(614, 44);
  242.             this.keyFrame5.Rotation = 0F;
  243.             this.keyFrame5.Visible = true;
  244.             this.keyFrame5.XScale = 2;
  245.             this.keyFrame5.YScale = 2;
  246.             this.keyFrame5.ZOrder = 0;
  247.             // 
  248.             // keyFrame6
  249.             // 
  250.             this.keyFrame6.Duration = 150;
  251.             this.keyFrame6.Opacity = 1F;
  252.             this.keyFrame6.Position = new System.Drawing.Point(12, 349);
  253.             this.keyFrame6.Rotation = 190F;
  254.             this.keyFrame6.Visible = true;
  255.             this.keyFrame6.XScale = 1;
  256.             this.keyFrame6.YScale = 1;
  257.             this.keyFrame6.ZOrder = 0;
  258.             // 
  259.             // sprite3
  260.             // 
  261.             this.sprite3.BorderColor = System.Drawing.Color.WhiteSmoke;
  262.             this.sprite3.BorderWidth = 2F;
  263.             this.sprite3.DrawBorder = false;
  264.             this.sprite3.DrawPath = false;
  265.             this.sprite3.DrawText = false;
  266.             this.sprite3.Font = new System.Drawing.Font("Arial", 24F, System.Drawing.FontStyle.Bold);
  267.             this.sprite3.Image = ((System.Drawing.Bitmap)(resources.GetObject("sprite3.Image")));
  268.             this.sprite3.Opacity = 0.62F;
  269.             this.sprite3.PathClosed = true;
  270.             this.sprite3.Position = new System.Drawing.Point(310, 186);
  271.             this.sprite3.Rotation = 136.8F;
  272.             this.sprite3.Size = new System.Drawing.Size(217, 217);
  273.             sound3.SoundFile = "";
  274.             this.sprite3.Sound = sound3;
  275.             this.sprite3.Text = "Sprite";
  276.             this.sprite3.TextColor = System.Drawing.Color.DarkRed;
  277.             this.sprite3.Timeline.AddRange(new AnimationStudio.KeyFrame[] {
  278.                                                                               this.keyFrame7,
  279.                                                                               this.keyFrame8});
  280.             this.sprite3.TransparentColor = System.Drawing.Color.Transparent;
  281.             this.sprite3.XScale = 0.81F;
  282.             this.sprite3.YScale = 0.81F;
  283.             this.sprite3.ZOrder = 3;
  284.             // 
  285.             // keyFrame7
  286.             // 
  287.             this.keyFrame7.Duration = 100;
  288.             this.keyFrame7.Opacity = 1F;
  289.             this.keyFrame7.Position = new System.Drawing.Point(310, 186);
  290.             this.keyFrame7.Rotation = 0F;
  291.             this.keyFrame7.Visible = true;
  292.             this.keyFrame7.XScale = 1;
  293.             this.keyFrame7.YScale = 1;
  294.             this.keyFrame7.ZOrder = 3;
  295.             // 
  296.             // keyFrame8
  297.             // 
  298.             this.keyFrame8.Duration = 100;
  299.             this.keyFrame8.Opacity = 0F;
  300.             this.keyFrame8.Position = new System.Drawing.Point(310, 186);
  301.             this.keyFrame8.Rotation = 360F;
  302.             this.keyFrame8.Visible = true;
  303.             this.keyFrame8.XScale = 0.5;
  304.             this.keyFrame8.YScale = 0.5;
  305.             this.keyFrame8.ZOrder = 3;
  306.             // 
  307.             // sprite4
  308.             // 
  309.             this.sprite4.BorderColor = System.Drawing.Color.WhiteSmoke;
  310.             this.sprite4.BorderWidth = 2F;
  311.             this.sprite4.DrawBorder = false;
  312.             this.sprite4.DrawText = false;
  313.             this.sprite4.Font = new System.Drawing.Font("Arial", 24F, System.Drawing.FontStyle.Bold);
  314.             this.sprite4.Image = ((System.Drawing.Bitmap)(resources.GetObject("sprite4.Image")));
  315.             this.sprite4.PathClosed = true;
  316.             this.sprite4.PathForm = AnimationStudio.PathFormEnumeration.linear;
  317.             this.sprite4.Position = new System.Drawing.Point(99, 223);
  318.             this.sprite4.Rotation = 187.5F;
  319.             this.sprite4.Size = new System.Drawing.Size(57, 57);
  320.             sound4.SoundFile = "";
  321.             this.sprite4.Sound = sound4;
  322.             this.sprite4.Text = "Sprite";
  323.             this.sprite4.TextColor = System.Drawing.Color.DarkRed;
  324.             this.sprite4.Timeline.AddRange(new AnimationStudio.KeyFrame[] {
  325.                                                                               this.keyFrame9,
  326.                                                                               this.keyFrame10,
  327.                                                                               this.keyFrame11,
  328.                                                                               this.keyFrame12,
  329.                                                                               this.keyFrame13});
  330.             this.sprite4.TransparentColor = System.Drawing.Color.Black;
  331.             this.sprite4.XScale = 1F;
  332.             this.sprite4.YScale = 1F;
  333.             this.sprite4.ZOrder = 4;
  334.             // 
  335.             // keyFrame9
  336.             // 
  337.             this.keyFrame9.Duration = 32;
  338.             this.keyFrame9.Opacity = 1F;
  339.             this.keyFrame9.Position = new System.Drawing.Point(392, 219);
  340.             this.keyFrame9.Rotation = 1000F;
  341.             this.keyFrame9.Visible = true;
  342.             this.keyFrame9.XScale = 1;
  343.             this.keyFrame9.YScale = 1;
  344.             this.keyFrame9.ZOrder = 4;
  345.             // 
  346.             // keyFrame10
  347.             // 
  348.             this.keyFrame10.Duration = 32;
  349.             this.keyFrame10.Opacity = 1F;
  350.             this.keyFrame10.Position = new System.Drawing.Point(100, 461);
  351.             this.keyFrame10.Rotation = 0F;
  352.             this.keyFrame10.Visible = true;
  353.             this.keyFrame10.XScale = 1;
  354.             this.keyFrame10.YScale = 1;
  355.             this.keyFrame10.ZOrder = 4;
  356.             // 
  357.             // keyFrame11
  358.             // 
  359.             this.keyFrame11.Duration = 32;
  360.             this.keyFrame11.Opacity = 1F;
  361.             this.keyFrame11.Position = new System.Drawing.Point(615, 181);
  362.             this.keyFrame11.Rotation = 0F;
  363.             this.keyFrame11.Visible = true;
  364.             this.keyFrame11.XScale = 5;
  365.             this.keyFrame11.YScale = 2;
  366.             this.keyFrame11.ZOrder = 4;
  367.             // 
  368.             // keyFrame12
  369.             // 
  370.             this.keyFrame12.Duration = 32;
  371.             this.keyFrame12.Opacity = 1F;
  372.             this.keyFrame12.Position = new System.Drawing.Point(51, 32);
  373.             this.keyFrame12.Rotation = 0F;
  374.             this.keyFrame12.Visible = true;
  375.             this.keyFrame12.XScale = 1;
  376.             this.keyFrame12.YScale = 1;
  377.             this.keyFrame12.ZOrder = 4;
  378.             // 
  379.             // keyFrame13
  380.             // 
  381.             this.keyFrame13.Duration = 32;
  382.             this.keyFrame13.Opacity = 1F;
  383.             this.keyFrame13.Position = new System.Drawing.Point(31, 224);
  384.             this.keyFrame13.Rotation = 0F;
  385.             this.keyFrame13.Visible = true;
  386.             this.keyFrame13.XScale = 1;
  387.             this.keyFrame13.YScale = 1;
  388.             this.keyFrame13.ZOrder = 4;
  389.             // 
  390.             // Form1
  391.             // 
  392.             this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
  393.             this.ClientSize = new System.Drawing.Size(688, 534);
  394.             this.Controls.Add(this.spritePanel1);
  395.             this.Name = "Form1";
  396.             this.Text = "Sprites";
  397.             this.spritePanel1.ResumeLayout(false);
  398.             this.ResumeLayout(false);
  399.  
  400.         }
  401.         #endregion
  402.  
  403.         /// <summary>
  404.         /// The main entry point for the application.
  405.         /// </summary>
  406.         [STAThread]
  407.         static void Main() 
  408.         {
  409.             Application.Run(new Form1());
  410.         }
  411.     }
  412. }
  413.