コード例 #1
0
        /********************************************
        * Paints the window and changes its region *
        ********************************************/
        private void PuppetForm_Paint(object sender, PaintEventArgs e)
        {
            // Runs when the form is first drawn
            if (firstDraw)
            {
                // Draw the target image onto the form
                firstDraw = false;
                image     = new Bitmap("..\\..\\target.png");
                RegionFactory factory = new RegionFactory();
                Size = image.Size;
                factory.add(image, Color.FromArgb(255, 0, 0, 0));
                Region = factory.region;

                // Be creepy and say hi
                Say("Hello and welcome! I am your totally not shady friend, nice to meet you!", 30000, ToolTipIcon.Error);
                Notify("Did I mention that I can also talk to you from the taskbar?", 30000, ToolTipIcon.Error);
            }

            // Draw the form
            e.Graphics.DrawImage(image, 0, 0);
        }