[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

fancy closing of a C#. How?

Posted on 2011-04-18
4
Medium Priority
?
324 Views
Last Modified: 2012-05-11
Hi there;

I want my form to be closed pixelated in C#. Is it possible? Could you provide me a link?

Kind regards.
0
Comment
Question by:jazzIIIlove
  • 2
4 Comments
 
LVL 17

Accepted Solution

by:
Carlos Villegas earned 1800 total points
ID: 35420586
I know that you are asking for a pixelate effect, but maybe you are interested in this fading effect:
public partial class Form1 : Form
{
    bool fading = false;
    bool fadingComplete = false;
    System.Windows.Forms.Timer myTimer = null;

    public Form1()
    {
        InitializeComponent();
    }

    protected override void OnClosing(CancelEventArgs e)
    {
        if (fading && !fadingComplete)
        {
            e.Cancel = true;
            return;
        }

        if (!fading)
        {
            fading = true;
            myTimer = new System.Windows.Forms.Timer();
            myTimer.Interval = 50;
            myTimer.Tick += new EventHandler(myTimer_Tick);
            myTimer.Start();
            e.Cancel = true;
            return;
        }

        base.OnClosing(e);
    }

    void myTimer_Tick(object sender, EventArgs e)
    {
        if (this.Opacity > 0)
        {
            this.Opacity -= 0.1;
        }
        else
        {
            myTimer.Stop();
            fadingComplete = true;
            this.Close();
        }
    }
}

To test, create a new windows forms project and replace the Form1 class with this.

Open in new window

0
 
LVL 16

Assisted Solution

by:Kalpesh Chhatrala
Kalpesh Chhatrala earned 200 total points
ID: 35421163
0
 
LVL 12

Author Closing Comment

by:jazzIIIlove
ID: 35425532
good :)
0
 
LVL 17

Expert Comment

by:Carlos Villegas
ID: 35425713
Glad to help buddy!
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses
Course of the Month19 days, 5 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question