Solved

ARRRRRRGGGGGGGGGG HELP

Posted on 2006-11-07
3
211 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

623 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