Пример #1
0
        // function that make all the necessary operations when the the app is started (the form is loaded)
        private void FrmScSaver_Load(object sender, EventArgs e)
        {
            // Array of all path to the images in specified folder
            string[] images = System.IO.Directory.GetFiles("pics");

            // For each picture in path list
            foreach (string image in images)
            {
                // Add it to the BGImages list
                BGImages.Add(new Bitmap(image));
            }

            // Loop that some amount of pictures
            for (int i = 0; i < 100; ++i)
            {
                BritPic mp = new BritPic
                {
                    // If the number is larger then count of images start from the beggining
                    PicNum = i % BGImages.Count,

                    // Get the random X coordinates
                    X = rand.Next(0, Width),

                    // Get the random Y coordinates
                    Y = rand.Next(0, Height)
                };

                // Add that structure to the BritPic class list
                BritPics.Add(mp);
            }
        }
Пример #2
0
        private void frmScreenSaver_Load(object sender, EventArgs e)
        {
            string[] images = System.IO.Directory.GetFiles("pics");

            foreach (string image in images)
            {
                BGImages.Add(new Bitmap(image));
            }
            for (int i = 0; i < 50; ++i)
            {
                BritPic mp = new BritPic();
                mp.PicNum = i % BGImages.Count;
                mp.x      = rand.Next(0, Width);
                mp.y      = rand.Next(0, Height);
                BritPics.Add(mp);
            }
        }
Пример #3
0
        private void frmscsaver_Load(object sender, EventArgs e)
        {
            string[] images = System.IO.Directory.GetFiles("pics");

            foreach (string image in images)
            {
                BGImages.Add(new Bitmap(image));
            }

            for (int i = 0; i < 3000; i++)
            {
                BritPic np = new BritPic();
                np.PicNum = i % BGImages.Count;
                np.X      = rand.Next(0, Width);
                np.Y      = rand.Next(0, Height);
                BritPics.Add(np);
            }
        }
Пример #4
0
        private void FromScSaver_Load(object sender, EventArgs e)
        {
            string[] images = System.IO.Directory.GetFiles("pics"); // put all the file names in pics dir into the images variable, pick all the images from pics and dump it in images variable

            foreach (string image in images)                        // looking for each text image in images
            {
                BGImages.Add(new Bitmap(image));
            }
            for (int i = 0; i < 50; ++i)
            {
                BritPic mp = new BritPic();
                mp.PicNum = i % BGImages.Count;
                mp.x      = rand.Next(0, Width);
                mp.y      = rand.Next(0, Height);


                BritPics.Add(mp);
            }
        }
Пример #5
0
        private void FrmScSaver_Load(object sender, EventArgs e)
        {
            string[] images = System.IO.Directory.GetFiles("pics");

            foreach (string image in images)
            {
                BGImages.Add(new Bitmap(image));
            }

            for (int i = 0; i < 96; i++)
            {
                BritPic mp = new BritPic();
                mp.PicNum = i % BGImages.Count;
                mp.X      = rand.Next(0, Width);
                mp.Y      = rand.Next(0, Height);
                BritPics.Add(mp);
                Thread.Sleep(500);
            }
        }
Пример #6
0
        private void screensaver_Load(object sender, EventArgs e)
        {
            string[] images = System.IO.Directory.GetFiles("pics");

            foreach (string image in images)
            {
                BGImages.Add(new Bitmap(image));
            }
            for (int i = 0; i < 1000; ++i)
            {
                BritPic mp = new BritPic();
                mp.PicNum = i % BGImages.Count;
                mp.X      = rand.Next(0, Width);
                mp.Y      = rand.Next(0, Height);

                //mp.Speed = rand.Next(100, 300) / 100.0f;

                BritPics.Add(mp);
            }
        }
Пример #7
0
        private void frmScreenSaver_Load(object sender, EventArgs e)
        {
            string[] images = System.IO.Directory.GetFiles("Images");

            //take all files in the directory and add them to List<Image>
            foreach (string image in images)
            {
                BGImages.Add(new Bitmap(image));
            }

            //create 50 images on screen
            for (int ii = 0; ii < 50; ii++)
            {
                BritPic mp = new BritPic();
                mp.PicNum = ii % BGImages.Count;
                mp.x      = rand.Next(0, Width);
                mp.y      = rand.Next(0, Height);
                BritPics.Add(mp);
            }
        }
Пример #8
0
        private void frmScSaver_Load(object sender, EventArgs e)
        {
            string[] images = System.IO.Directory.GetFiles("pics");// put a list of file names in the pics directory into images variable

            foreach (string image in images)
            {
                BGImages.Add(new Bitmap(image));// creates a new bitmap picture and add it to the bgimage array
            }

            for (int i = 0; i < 50; ++i)    // as long as i is less than 50, it will keep on increasing by 1. It will look into the directory for images and it will check as long as the images is less than 50 it will keep adding images to the screen
            {
                BritPic mp = new BritPic(); //
                mp.PicNum = i % BGImages.Count;
                mp.X      = rand.Next(0, Width);
                mp.Y      = rand.Next(0, Height);



                BritPics.Add(mp); // will add and object to the end of list
            }
        }
Пример #9
0
        private void formScreenSaver_Load(object sender, EventArgs e)
        {
            //get list of pics into images array
            string[] images = System.IO.Directory.GetFiles("pics");
            //loop through images
            foreach (string image in images)
            {
                //creates new bitmap picture and add to BGImages array
                BGImages.Add(new Bitmap(image));
            }

            //looks for images in directory and keep adding up to 50
            for (int i = 0; i < 50; ++i)
            {
                BritPic np = new BritPic();
                np.PicNum = i % BGImages.Count;
                np.X      = rand.Next(0, Width);
                np.Y      = rand.Next(0, Height);

                Britpics.Add(np);
            }
        }
Пример #10
0
        private void FormScSaver_Load(object sender, EventArgs e)
        {
            //
            string[] images = System.IO.Directory.GetFiles("pics");

            foreach (string image in images)
            {
                //creates new bitmap image from the pics folder and adds it to the array
                BGImages.Add(new Bitmap(image));
            }

            for (int i = 0; i < 50; ++i)
            {
                //it'll keep adding images randomly to the screen till it reaches 50
                BritPic mp = new BritPic();
                mp.PicNum = i % BGImages.Count;
                mp.x      = rand.Next(0, Width);
                mp.y      = rand.Next(0, Height);
                mp.speed  = rand.Next(100, 300) / 100.0f;

                BritPics.Add(mp);
            }
        }
Пример #11
0
        private void frmScreenSaver_Load(object sender, EventArgs e)
        {
            //stores list of file names in my pics folder in the images variable
            string[] images = Directory.GetFiles("pics");

            foreach (string image in images)
            {
                //each string in images will create a new bitmap picture in the BGImages array variable (a global variable)
                BGImages.Add(new Bitmap(image));
            }

            for (int i = 0; i < 50; i++)
            {
                //you can add images until you reach 50 images
                BritPic mp = new BritPic();
                mp.PicNum = i % BGImages.Count;
                mp.X      = random.Next(0, Width);  //gets random num between 0 and the window's width
                mp.Y      = random.Next(0, Height); //gets random num between 0 and the window's height

                //mp.Speed = random.Next(100, 300) / 100.0f;

                BritPics.Add(mp); //mp object will be added to BritPics list
            }
        }