Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
lectures.docx
Скачиваний:
0
Добавлен:
01.07.2025
Размер:
8.12 Mб
Скачать

Topic: Working with files.

Example-1: To delete a file.

Result: This example will do the similar thing: it will delete a file, but not a folder.

Example-2: To copy a file to a different location

Result: It will copy a file to the location “D:\\” and renames file as “test.txt”.

Example-3: Or you can use move method instead of copy method

Result: It will move a file to the location “D:\\” and renames file as “test1.txt”.

Example-4:

Result: you can see a path of selected file.

Example-5:

Result: you can see an extension of selected file.

Example-6:

Result: you will get a file name of a selected file with its extension.

Example-7:

Result: you will get a file name of a selected file without its extension.

Topic: Process class

It is possible not just to select, but to open a file.

Example-1:

Result: it will open a file which you will select.

Example-2:

Result: this will open a notepad.

Example-3:

Result: this will open comand prompt.

Example-4:

Result: this will show you a name of program on which you are working now.

Example-5:

Result: this will show you a name of programs which are active now.

Example-6:

Result: do not do this.

Lab assignment:

  • to develop a notepad application

It should have the following menus:

File:

  • New

  • Open

  • Save

  • Exit

Edit:

  • Undo

  • Redo

  • Copy

  • Paste

  • Cut

  • Select All

  • Date/Time

Format:

  • Font

  • Colour

Topic: DateTime

Example-1:

Result: it will show you today’s date.

Example-2:

Result: It is same like previous, but this includes time also.

Example-3:

Result will be “True”, because it is a leap year.

Exaample-4:

Result will be “29”, because there are 29 days in February 2012.

Topic:DateTimePicker

Example-1:

Result: whatever date user selects it will display that date.

Topic: Picture Box and Image Class

Example-1:

Result:

Example-2:

Result: this is same as previous example.

Example-3: if you know URL of a picture then you can do as below.

Example-4:

Result:

Topic: ColorDialog

Example-1:

Result:

Example-2:

Result:

Example-3:

Result:

Topic: FontDialog

Example-1:

Result:

Example-2:

Result:

Example-3:

Result:

Example-4:

Result:

Example-5: in order to write a text in selected color we need to add one more method as given below:

Result:

Topic: Timer

Example-1:

Result: You will get infinite messages.

Example-2: in order to stop those messages we use stop method.

Result: you will get one Hello message after one second of delay.

Example-3:

Result:

Topic: SoundPlayer.

To play wav sounds we have to call library as “using System.Media;”.

Example-1:

Result: It will play your selected wav sound file.

Example-2: alternate way to play a wav sound file.

Example-3:

Result: this will play a selected sound file continuously.

Example-4:

Result: this will play system’s sound.

Topic: Masked Text Box

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]