1 00:00:00,660 --> 00:00:09,990 Hello In this lecture we are going to add a picture directory that will include the pictures or images 2 00:00:10,020 --> 00:00:13,830 we want to be displayed in our screen saver. 3 00:00:13,830 --> 00:00:22,020 We'll also be implementing some code I have already added My Big Show directory. 4 00:00:22,050 --> 00:00:27,750 I'm just gonna show you how to do that so you click on Start. 5 00:00:27,750 --> 00:00:32,290 Go to documents Visual Studio usually stalls. 6 00:00:32,300 --> 00:00:40,850 This project in your documents directory so click on Visual Studio click on projects click on the name 7 00:00:40,850 --> 00:00:50,990 of your project as my project click on the project name again click on the bean directory click on debug 8 00:00:51,800 --> 00:00:56,270 and thus the you should have a directory called picks. 9 00:00:56,300 --> 00:01:02,620 Make sure you your directory is named the same way and inside you just have a list. 10 00:01:02,630 --> 00:01:04,730 I've got a list of images it doesn't matter. 11 00:01:04,730 --> 00:01:07,890 You can have a few you can have many doesn't really matter. 12 00:01:07,910 --> 00:01:18,480 What's important is that you have an image called a directory called picks in that project. 13 00:01:18,530 --> 00:01:20,590 Direct in that project area. 14 00:01:21,050 --> 00:01:21,400 OK. 15 00:01:21,410 --> 00:01:26,440 It must be within the being and in the tick in the debug section. 16 00:01:26,450 --> 00:01:30,920 Make sure inside the bin directory and then the debug directory. 17 00:01:31,100 --> 00:01:32,710 You've got a directory. 18 00:01:32,710 --> 00:01:36,440 Court picks that will include your pictures. 19 00:01:36,500 --> 00:01:46,340 So this will be the pictures that the screen saver will be referencing the code you'll be writing for. 20 00:01:46,340 --> 00:01:52,440 This project will help you later on which your skills. 21 00:01:52,460 --> 00:01:55,940 And you can apply that code to other stuff as well. 22 00:01:57,820 --> 00:02:03,600 So click on the form design and the two ways you can do that. 23 00:02:03,600 --> 00:02:09,340 You can either double click what one can achieve I want to see the code behind the phone Visual Studio 24 00:02:09,370 --> 00:02:18,850 generates kind of like his skeletal code so you can either double click or you can go view and select 25 00:02:18,850 --> 00:02:20,660 code or select F seven. 26 00:02:20,700 --> 00:02:22,450 I'm just going to select code. 27 00:02:22,540 --> 00:02:24,610 You can also do F seven if you wish. 28 00:02:24,920 --> 00:02:30,160 And that will give you the code behind the form. 29 00:02:30,430 --> 00:02:37,900 This was the event handler we generated in our previous lecture that will enable you to close the screen 30 00:02:37,900 --> 00:02:40,720 once you press any key on your keyboard. 31 00:02:41,440 --> 00:02:49,120 So what we are going to do we are going to create a couple of variables. 32 00:02:49,570 --> 00:02:51,220 So I added some code here. 33 00:02:51,220 --> 00:02:53,710 This is the code I have added. 34 00:02:53,710 --> 00:02:58,780 Make sure you add it just both this public partial class. 35 00:02:58,780 --> 00:03:11,580 Make sure it is between this curly braces and this public firm src a C saver so what does he have created. 36 00:03:11,700 --> 00:03:13,620 Two variables. 37 00:03:13,620 --> 00:03:24,260 Line 15 here is it will store is a variable that hose and every one of them will be an array of pictures. 38 00:03:25,230 --> 00:03:25,790 Okay. 39 00:03:25,800 --> 00:03:35,410 And the second one on line sixteen will be an array or Brit pick objects. 40 00:03:35,690 --> 00:03:41,680 Notice there's some squiggly lines because this class here I've not defined the class yet. 41 00:03:41,880 --> 00:03:43,770 So that's why we use to do is complain. 42 00:03:43,770 --> 00:03:45,820 I'm gonna define the class in a minute. 43 00:03:46,050 --> 00:03:49,240 So but this to a list basically is a kind of an array. 44 00:03:49,890 --> 00:03:56,480 Okay so I've got two arrays here one is gonna store the images and the other is gonna store the print 45 00:03:56,790 --> 00:03:58,300 pick objects. 46 00:03:58,650 --> 00:03:59,320 All right. 47 00:03:59,440 --> 00:04:10,080 The this brick pick is a special data type and it's going to hold a position for each picture in our 48 00:04:10,100 --> 00:04:11,210 screensaver. 49 00:04:11,360 --> 00:04:14,220 But I'm gonna define that class shortly. 50 00:04:14,220 --> 00:04:22,740 Also I have used a random object here and given the name round we're going to use this to generate random 51 00:04:22,740 --> 00:04:23,790 numbers. 52 00:04:23,790 --> 00:04:30,280 So a given it equals to a new new creates a new instance of it new Random. 53 00:04:30,300 --> 00:04:30,670 Okay. 54 00:04:30,690 --> 00:04:33,540 So that's this bit of the code. 55 00:04:33,540 --> 00:04:39,840 Just know that the first line here this will store an array of pictures. 56 00:04:39,840 --> 00:04:45,870 The second we store an array of Brit pick objects. 57 00:04:46,800 --> 00:04:51,260 Some added some more code I have now created that class. 58 00:04:51,340 --> 00:04:53,350 So this is what I've just added. 59 00:04:53,350 --> 00:04:59,110 I've created the class Brit pic so you can see the squiggly lines gone now. 60 00:05:00,310 --> 00:05:05,290 In Visual Studio if you're not sure what the code does just place your mouse over it. 61 00:05:05,680 --> 00:05:08,350 And the tool tip will give you a guide. 62 00:05:08,500 --> 00:05:15,340 He says he tells you that you just put your mouse over it and it will tell you what that code does. 63 00:05:15,340 --> 00:05:20,500 So I created a class called it Brit pig. 64 00:05:20,530 --> 00:05:29,750 This is a special data type this brick pig is going to hold the position for each picture in our screen 65 00:05:29,750 --> 00:05:32,320 saver. 66 00:05:32,320 --> 00:05:38,020 I've also declared several variables here within this breed pig class. 67 00:05:38,020 --> 00:05:39,420 So they are public. 68 00:05:39,430 --> 00:05:43,510 I means they can be accessed from any parts of the code. 69 00:05:43,630 --> 00:05:46,500 And the first one the data type is an integer. 70 00:05:46,510 --> 00:05:50,360 I've given it a name of Pick number. 71 00:05:50,590 --> 00:05:54,310 Second it is a float data type. 72 00:05:54,310 --> 00:06:05,590 It tells you float represents a single precision floating point number and given it the value of x the 73 00:06:05,590 --> 00:06:06,840 same data type here. 74 00:06:06,910 --> 00:06:13,380 Float again given a variable of Y another float data type. 75 00:06:13,840 --> 00:06:23,290 And I've given it a name of speed so we'll be using these variables later on in the project. 76 00:06:23,290 --> 00:06:26,460 That's set for this project. 77 00:06:26,470 --> 00:06:26,940 Sorry. 78 00:06:27,040 --> 00:06:32,500 That's it for this lecture not the project will progress in the next lecture. 79 00:06:32,500 --> 00:06:33,520 Thanks for watching. 80 00:06:33,520 --> 00:06:34,150 Bye for now.