Solved

ARRRRRRGGGGGGGGGG HELP

Posted on 2006-11-07
3
203 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

706 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now