Click here to Skip to main content
15,897,518 members
Articles / Multimedia / GDI+

Fading Forms In and Out

Rate me:
Please Sign up or sign in to vote.
4.17/5 (15 votes)
13 Aug 2007CPOL2 min read 107.4K   1.3K   85  
Add fade transitions to your applications
namespace FadeForm
{
    partial class FadeFormDemo
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            this.numericUpDownMinimizedOpacity = new System.Windows.Forms.NumericUpDown();
            this.numericUpDownActiveOpacity = new System.Windows.Forms.NumericUpDown();
            this.numericUpDownInactiveOpacity = new System.Windows.Forms.NumericUpDown();
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.label3 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.label1 = new System.Windows.Forms.Label();
            this.groupBox2 = new System.Windows.Forms.GroupBox();
            this.buttonTargetOpacity = new System.Windows.Forms.Button();
            this.numericUpDownTargetOpacity = new System.Windows.Forms.NumericUpDown();
            this.groupBox3 = new System.Windows.Forms.GroupBox();
            this.numericUpDownFadeTime = new System.Windows.Forms.NumericUpDown();
            this.timer1 = new System.Windows.Forms.Timer(this.components);
            ((System.ComponentModel.ISupportInitialize)(this.numericUpDownMinimizedOpacity)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.numericUpDownActiveOpacity)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.numericUpDownInactiveOpacity)).BeginInit();
            this.groupBox1.SuspendLayout();
            this.groupBox2.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.numericUpDownTargetOpacity)).BeginInit();
            this.groupBox3.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.numericUpDownFadeTime)).BeginInit();
            this.SuspendLayout();
            // 
            // numericUpDownMinimizedOpacity
            // 
            this.numericUpDownMinimizedOpacity.DecimalPlaces = 2;
            this.numericUpDownMinimizedOpacity.Increment = new decimal(new int[] {
            5,
            0,
            0,
            131072});
            this.numericUpDownMinimizedOpacity.Location = new System.Drawing.Point(104, 14);
            this.numericUpDownMinimizedOpacity.Maximum = new decimal(new int[] {
            1,
            0,
            0,
            0});
            this.numericUpDownMinimizedOpacity.Name = "numericUpDownMinimizedOpacity";
            this.numericUpDownMinimizedOpacity.Size = new System.Drawing.Size(59, 20);
            this.numericUpDownMinimizedOpacity.TabIndex = 0;
            this.numericUpDownMinimizedOpacity.ValueChanged += new System.EventHandler(this.numericUpDownMinimizedOpacity_ValueChanged);
            // 
            // numericUpDownActiveOpacity
            // 
            this.numericUpDownActiveOpacity.DecimalPlaces = 2;
            this.numericUpDownActiveOpacity.Increment = new decimal(new int[] {
            5,
            0,
            0,
            131072});
            this.numericUpDownActiveOpacity.Location = new System.Drawing.Point(104, 40);
            this.numericUpDownActiveOpacity.Maximum = new decimal(new int[] {
            1,
            0,
            0,
            0});
            this.numericUpDownActiveOpacity.Name = "numericUpDownActiveOpacity";
            this.numericUpDownActiveOpacity.Size = new System.Drawing.Size(59, 20);
            this.numericUpDownActiveOpacity.TabIndex = 1;
            this.numericUpDownActiveOpacity.ValueChanged += new System.EventHandler(this.numericUpDownActiveOpacity_ValueChanged);
            // 
            // numericUpDownInactiveOpacity
            // 
            this.numericUpDownInactiveOpacity.DecimalPlaces = 2;
            this.numericUpDownInactiveOpacity.Increment = new decimal(new int[] {
            5,
            0,
            0,
            131072});
            this.numericUpDownInactiveOpacity.Location = new System.Drawing.Point(104, 66);
            this.numericUpDownInactiveOpacity.Maximum = new decimal(new int[] {
            1,
            0,
            0,
            0});
            this.numericUpDownInactiveOpacity.Name = "numericUpDownInactiveOpacity";
            this.numericUpDownInactiveOpacity.Size = new System.Drawing.Size(59, 20);
            this.numericUpDownInactiveOpacity.TabIndex = 2;
            this.numericUpDownInactiveOpacity.ValueChanged += new System.EventHandler(this.numericUpDownInactiveOpacity_ValueChanged);
            // 
            // groupBox1
            // 
            this.groupBox1.Controls.Add(this.label3);
            this.groupBox1.Controls.Add(this.numericUpDownInactiveOpacity);
            this.groupBox1.Controls.Add(this.label2);
            this.groupBox1.Controls.Add(this.numericUpDownActiveOpacity);
            this.groupBox1.Controls.Add(this.label1);
            this.groupBox1.Controls.Add(this.numericUpDownMinimizedOpacity);
            this.groupBox1.Location = new System.Drawing.Point(12, 12);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new System.Drawing.Size(171, 94);
            this.groupBox1.TabIndex = 4;
            this.groupBox1.TabStop = false;
            this.groupBox1.Text = "Opacities";
            // 
            // label3
            // 
            this.label3.AutoSize = true;
            this.label3.Location = new System.Drawing.Point(14, 68);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(84, 13);
            this.label3.TabIndex = 5;
            this.label3.Text = "Inactive Opacity";
            // 
            // label2
            // 
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(22, 42);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(76, 13);
            this.label2.TabIndex = 4;
            this.label2.Text = "Active Opacity";
            // 
            // label1
            // 
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(6, 16);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(92, 13);
            this.label1.TabIndex = 3;
            this.label1.Text = "Minimized Opacity";
            // 
            // groupBox2
            // 
            this.groupBox2.Controls.Add(this.buttonTargetOpacity);
            this.groupBox2.Controls.Add(this.numericUpDownTargetOpacity);
            this.groupBox2.Location = new System.Drawing.Point(12, 112);
            this.groupBox2.Name = "groupBox2";
            this.groupBox2.Size = new System.Drawing.Size(171, 46);
            this.groupBox2.TabIndex = 5;
            this.groupBox2.TabStop = false;
            this.groupBox2.Text = "Target Opacity";
            // 
            // buttonTargetOpacity
            // 
            this.buttonTargetOpacity.Location = new System.Drawing.Point(71, 19);
            this.buttonTargetOpacity.Name = "buttonTargetOpacity";
            this.buttonTargetOpacity.Size = new System.Drawing.Size(94, 20);
            this.buttonTargetOpacity.TabIndex = 4;
            this.buttonTargetOpacity.Text = "Fade To Value";
            this.buttonTargetOpacity.UseVisualStyleBackColor = true;
            this.buttonTargetOpacity.Click += new System.EventHandler(this.buttonTargetOpacity_Click);
            // 
            // numericUpDownTargetOpacity
            // 
            this.numericUpDownTargetOpacity.DecimalPlaces = 2;
            this.numericUpDownTargetOpacity.Increment = new decimal(new int[] {
            5,
            0,
            0,
            131072});
            this.numericUpDownTargetOpacity.Location = new System.Drawing.Point(6, 19);
            this.numericUpDownTargetOpacity.Maximum = new decimal(new int[] {
            1,
            0,
            0,
            0});
            this.numericUpDownTargetOpacity.Name = "numericUpDownTargetOpacity";
            this.numericUpDownTargetOpacity.Size = new System.Drawing.Size(59, 20);
            this.numericUpDownTargetOpacity.TabIndex = 3;
            // 
            // groupBox3
            // 
            this.groupBox3.Controls.Add(this.numericUpDownFadeTime);
            this.groupBox3.Location = new System.Drawing.Point(12, 164);
            this.groupBox3.Name = "groupBox3";
            this.groupBox3.Size = new System.Drawing.Size(171, 46);
            this.groupBox3.TabIndex = 6;
            this.groupBox3.TabStop = false;
            this.groupBox3.Text = "Transition Speed";
            // 
            // numericUpDownFadeTime
            // 
            this.numericUpDownFadeTime.DecimalPlaces = 2;
            this.numericUpDownFadeTime.Increment = new decimal(new int[] {
            5,
            0,
            0,
            131072});
            this.numericUpDownFadeTime.Location = new System.Drawing.Point(6, 19);
            this.numericUpDownFadeTime.Maximum = new decimal(new int[] {
            10,
            0,
            0,
            0});
            this.numericUpDownFadeTime.Name = "numericUpDownFadeTime";
            this.numericUpDownFadeTime.Size = new System.Drawing.Size(159, 20);
            this.numericUpDownFadeTime.TabIndex = 3;
            this.numericUpDownFadeTime.ValueChanged += new System.EventHandler(this.numericUpDownFadeTime_ValueChanged);
            // 
            // timer1
            // 
            this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
            // 
            // FadeFormDemo
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(193, 222);
            this.Controls.Add(this.groupBox3);
            this.Controls.Add(this.groupBox2);
            this.Controls.Add(this.groupBox1);
            this.Name = "FadeFormDemo";
            this.Opacity = 0.999;
            this.TargetOpacity = 1;
            this.Text = "FadeFormDemo";
            this.Activated += new System.EventHandler(this.FadeFormDemo_Activated);
            ((System.ComponentModel.ISupportInitialize)(this.numericUpDownMinimizedOpacity)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.numericUpDownActiveOpacity)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.numericUpDownInactiveOpacity)).EndInit();
            this.groupBox1.ResumeLayout(false);
            this.groupBox1.PerformLayout();
            this.groupBox2.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.numericUpDownTargetOpacity)).EndInit();
            this.groupBox3.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.numericUpDownFadeTime)).EndInit();
            this.ResumeLayout(false);

        }

        #endregion

        private System.Windows.Forms.NumericUpDown numericUpDownMinimizedOpacity;
        private System.Windows.Forms.NumericUpDown numericUpDownActiveOpacity;
        private System.Windows.Forms.NumericUpDown numericUpDownInactiveOpacity;
        private System.Windows.Forms.GroupBox groupBox1;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.GroupBox groupBox2;
        private System.Windows.Forms.Button buttonTargetOpacity;
        private System.Windows.Forms.NumericUpDown numericUpDownTargetOpacity;
        private System.Windows.Forms.GroupBox groupBox3;
        private System.Windows.Forms.NumericUpDown numericUpDownFadeTime;
        private System.Windows.Forms.Timer timer1;
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Instructor / Trainer
United States United States
I am a mechanical engineer that works as a high school math teacher in Mulberry, Arkansas. I use programming as one way to keep my mind sharp.

Comments and Discussions