Solved

ARRRRRRGGGGGGGGGG HELP

Posted on 2006-11-07
3
207 Views
Last Modified: 2012-05-05
Hi,
I am using the following code to have the form fade in over 5 seconds, but i cant see the shapes....

Opacity has been set to zero....


        private void timer1_Tick(object sender, EventArgs e)
        {
            this.Opacity = this.Opacity + 0.01;
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            this.TransparencyKey = Color.WhiteSmoke;
            this.BackColor = Color.WhiteSmoke;
            this.Refresh();
            Graphics g = this.CreateGraphics();
            g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.Default;
            g.DrawArc(new Pen(Brushes.Yellow, 6f), 10, 25, 817, 817, 315, 90);
            g.DrawArc(new Pen(Brushes.Green, 6f), 10, 25, 817, 817, 45, 90);
            g.DrawArc(new Pen(Brushes.Blue, 6f), 10, 25, 817, 817, 135, 90);
            g.DrawArc(new Pen(Brushes.Red, 6f), 10, 25, 817, 817, 225, 90);
            g.DrawRectangle(new Pen(Brushes.Black, 6f), 5, 20, 830, 830);
        }
0
Comment
Question by:schenkp
  • 2
3 Comments
 
LVL 48

Accepted Solution

by:
AlexFM earned 500 total points
ID: 17896011
Move drawing code to Paint event handler:

        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            Graphics g = e.Graphics;

            g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.Default;
            g.DrawArc(new Pen(Brushes.Yellow, 6f), 10, 25, 817, 817, 315, 90);
            g.DrawArc(new Pen(Brushes.Green, 6f), 10, 25, 817, 817, 45, 90);
            g.DrawArc(new Pen(Brushes.Blue, 6f), 10, 25, 817, 817, 135, 90);
            g.DrawArc(new Pen(Brushes.Red, 6f), 10, 25, 817, 817, 225, 90);
            g.DrawRectangle(new Pen(Brushes.Black, 6f), 5, 20, 830, 830);
        }

If changing opacity doesn't redraw form, invalidate it:

        private void timer1_Tick(object sender, EventArgs e)
        {
            this.Opacity = this.Opacity + 0.01;
            Invalidate();
        }
0
 

Author Comment

by:schenkp
ID: 17898327
I am getting a huge amount of flickering when the form reaches 100% Opacity.  How can i fix this?
0
 
LVL 48

Expert Comment

by:AlexFM
ID: 17900644
Try to use ControlStyles.DoubleBuffer style for the form.
0

Featured Post

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

773 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