Esempio n. 1
0
 protected override void OnPaint(PaintEventArgs e)
 {
     base.OnPaint(e);
     if (Troll.time == -1)
     {
         Troll.trollfaceRotated = Troll.RotateImageByAngle(Troll.trollfaceOriginal, (float)(Troll.times * 10));
         e.Graphics.DrawImage(Troll.trollfaceRotated, Troll.trollfaceLocation);
         if (Troll.times < 35)
         {
             Troll.times++;
         }
         else
         {
             Troll.times = 0;
         }
     }
     else
     {
         if (Troll.time < 60)
         {
             e.Graphics.DrawString("SUDDENLY", new Font("Arial", 128f), Brushes.Blue, new PointF(10f, (float)(base.Height / 2 - 64)));
             Troll.time++;
         }
         else
         {
             if (Troll.time < 100)
             {
                 e.Graphics.DrawString("A", new Font("Arial", 128f), Brushes.Blue, new PointF(10f, (float)(base.Height / 2 - 64)));
                 Troll.time++;
             }
             else
             {
                 if (Troll.time < 260)
                 {
                     e.Graphics.DrawString("TROLLFACE", new Font("Arial", 128f), Brushes.Blue, new PointF(10f, (float)(base.Height / 2 - 64)));
                     Troll.time++;
                 }
                 else
                 {
                     Troll.music.PlayLooping();
                     Troll.time = -1;
                 }
             }
         }
     }
     base.TopMost = true;
     base.Invalidate();
 }
Esempio n. 2
0
        public Troll()
        {
            this.InitializeComponent();
            this.DoubleBuffered  = true;
            base.Size            = new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height + 100);
            base.TopMost         = true;
            base.FormBorderStyle = FormBorderStyle.None;
            base.ControlBox      = false;
            base.DesktopLocation = new Point(0, 0);
            base.MinimizeBox     = (base.MaximizeBox = false);
            this.MinimumSize     = (this.MaximumSize = base.Size);
            base.TransparencyKey = (this.BackColor = Color.Red);
            base.ShowInTaskbar   = false;
            Troll.musicStream    = new MemoryStream(Resources.BarrelRoll);
            Troll.music.Stream.Seek(0L, SeekOrigin.Begin);
            Troll.trollfaceOriginal = Resources.Trollface;
            Troll.trollfaceRotated  = Troll.trollfaceOriginal;
            Troll.trollfaceLocation = new Point(base.Width / 2 - 540, -90);
            int windowLong = Troll.GetWindowLong(base.Handle, -20);

            Troll.SetWindowLong(base.Handle, -20, windowLong | 524288 | 32);
        }