예제 #1
0
 public void Rescale()
 {
     if (pics.Count != Glob.Amount || type != Glob.Type || path != Glob.Path)
     {
         g = this.CreateGraphics();
         for (int i = 0; i < pics.Count; i++)
         {
             g.FillRectangle(SystemBrushes.Control, pics[i].Bounds);
         }
         pics.Clear();
         g.Dispose();
         for (int i = 0; i < Glob.Amount; i++)
         {
             CFlake pic = new CFlake();
             pics.Add(pic);
             CreateFlake(pic);
         }
     }
 }
예제 #2
0
 private void InitPictureBox()
 {
     r1 = Registry.CurrentUser.OpenSubKey("SOFTWARE\\ClearAll\\DesktopMagic\\Data", true);
     if ((int)r1.GetValue("DMT") == 3)
     {
         if (File.Exists(Glob.Path))
         {
             pictureBox4.Image = Image.FromFile(Glob.Path);
         }
         else
         {
             Glob.Type = 1;
             MessageBox.Show("Can not find your picture!!?", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     r1.Close();
     r1.Dispose();
     for (int i = 0; i < amount; i++)
     {
         CFlake pic = new CFlake();
         pics.Add(pic);
         CreateFlake(pic);
     }
 }
예제 #3
0
        private void CreateFlake(CFlake pic)
        {
            path        = Glob.Path;
            Size        = Glob.Size;
            type        = Glob.Type;
            screenWidth = Screen.PrimaryScreen.WorkingArea.Width;
            if (type == 1)
            {
                pic.Image = pictureBox1.Image;
                size      = rnd.Next(36) + 5;
                pic.Size  = new System.Drawing.Size(size, size);
            }
            else if (type == 2)
            {
                pic.Image = pictureBox2.Image;
                size      = rnd.Next(8) + 5;
                pic.Size  = new System.Drawing.Size(size, size);
            }
            else if (type == 3)
            {
                pictureBox4.Image = Image.FromFile(Glob.Path);
                pic.Image         = pictureBox4.Image;
                size     = rnd.Next(Glob.Size) + 5;
                pic.Size = new System.Drawing.Size(size, size);
            }
            else if (type == 4)
            {
                pic.Image = pictureBox5.Image;
                size      = rnd.Next(25) + 5;
                pic.Size  = new System.Drawing.Size(size, size);
            }
            else
            {
                int o = rd.Next(1, 5);
                if (o == 1)
                {
                    pic.Image = pictureBox5.Image;
                    size      = rnd.Next(25) + 5;
                    pic.Size  = new System.Drawing.Size(size, size);
                }
                else if (o == 2)
                {
                    pic.Image = pictureBox1.Image;
                    size      = rnd.Next(36) + 5;
                    pic.Size  = new System.Drawing.Size(size, size);
                }
                else if (o == 3)
                {
                    pic.Image = pictureBox2.Image;
                    size      = rnd.Next(8) + 5;
                    pic.Size  = new System.Drawing.Size(size, size);
                }
                else
                {
                    if (File.Exists(Glob.Path))
                    {
                        pictureBox4.Image = Image.FromFile(Glob.Path);
                        pic.Image         = pictureBox4.Image;
                        size     = rnd.Next(Glob.Size) + 5;
                        pic.Size = new System.Drawing.Size(size, size);
                    }
                    else
                    {
                        int o1 = rd.Next(1, 5);
                        if (o1 == 1)
                        {
                            pic.Image = pictureBox5.Image;
                            size      = rnd.Next(25) + 5;
                            pic.Size  = new System.Drawing.Size(size, size);
                        }
                        else if (o1 == 2)
                        {
                            pic.Image = pictureBox1.Image;
                            size      = rnd.Next(36) + 5;
                            pic.Size  = new System.Drawing.Size(size, size);
                        }
                        else if (o1 == 3)
                        {
                            pic.Image = pictureBox2.Image;
                            size      = rnd.Next(8) + 5;
                            pic.Size  = new System.Drawing.Size(size, size);
                        }
                    }
                }
            }
            pic.Position = new System.Drawing.Point(rnd.Next(screenWidth), rnd.Next(-15, -10));
            int sign = rnd.Next(2) == 0 ? -1 : 1;

            pic.Direction = rnd.Next(10) * sign;
            pic.Speed     = rnd.Next(1);
        }