Lecture Notes for Fall 2007
The lectures are posted in HTML form. In some cases I have also posted a Word file.
If you find an error in the lecture notes, send me an email and I will correct it. If errors have been corrected, the files will be noted below as "updated". You can also send an email if you think the notes are confusing or just can be improved. Please be specific enough that I can figure out what needs fixing.
Friday, August 24: NO LAB THIS WEEK. Please study the green sheet carefully as we will not spend the first lecture going over it.
Monday, August 27: How Windows Works Event-driven programming; applications, windows, and messages. What messages are and how they are created and "sent". The main message loop; the application message queue. Processing messages. WinMain. The SDK (or the Win32 API) versus MFC versus .NET--three ways of writing Windows programs. (Word file).
Wednesday, August 29: Introduction to Visual Studio. Your first Windows program. (Word file).
Friday, August 31: Lab 1, Hello FCL.
Monday, September 3: Labor Day, no class.
Wednesday, September 5: Introduction to Windows Graphics. The Paint event; the Graphics class; rectangles, clipping, the invalid rectangle. FillRectangle, DrawRectangle, DrawEllipse. (Word file.)
Friday, September 7: Lab on graphics (StopLight lab).
Wednesday, September 12: Intermediate Graphics. Colors, lines and polygons, GraphicsPath and Region classes.. (Word file.)
Friday, September 14: Lab on the mouse (HitTest lab).
Monday, September 17: Introduction to menus. Creating a menu with Visual Studio, and writing handlers for the menu items. (Word file.)
Wednesday, September 19 : Dragging. Mouse capture; the Capture property; updating on MouseMove. Use of child windows for dragging. Conversion of coordinates from one window to another. (Word file.)
Friday, September 21: Lab on menus (Bonjour lab).
Monday, September 24: Introduction to printing (Word file) and arcs, pies, and area fills. (Word file). This material will not be covered on the midterm.
Wednesday, September 26: Review for the midterm. In class I will write a program similar to what you might expect on a midterm.
Friday, September 28: First midterm programming exam during lab time. You will be expected to write (without step-by-step instructions) a program that will put up a simple menu, and respond to menu choices by calling simple graphics commands, and respond to the mouse using correct hit-testing. Although you will have access to the course web site and your notes, you should not need to use precious time consulting them for these elementary tasks. These skills should be so well-practiced that you can complete such a program well within the lab time constraints. You should definitely prepare by trying the practice midterms at home. See the main course web page for links to those practice midterms.
Monday, October 1 : Controls. (Word file) Purposes and uses of pushbuttons, edit boxes, static text boxes, list boxes, combo boxes, radio buttons, check boxes, spin controls, sliders.
Push buttons (Word file). Using the form editor; handling the Click event; using the Anchor, Font, TextAlign, Image, ForeColor, and BackColor properties.
Wednesday, October 3: Modal Dialogs (Word file) Definition of a modal dialog; creating a new form to serve as a dialog; setting the properties of the form correctly; adding controls; setting the properties of the controls correctly; bringing up a dialog by initializing a dialog object, calling its ShowDialog method, checking the return value, and if it is DialogResult.OK, then retrieving the data and storing the data in application member variables. Data validation is not covered in this lecture.
You should repeat the example from this lecture, and similar examples of your own creation, at least once in preparation for Friday's lab, and many more times in preparation for the second midterm exam, until you can program a dialog box without reference to any instructions. This is considered a basic skill. Memorize the steps in the previous paragraph.
Friday, October 5: Lab on using a simple dialog box. (TuneTown lab)
Monday, October 8: Radio Buttons and List Boxes. (Word file). Creating, initializing, and responding to radio buttons. Creating and initializing a list box; adding strings to a list box; getting the current selection; deleting an item. Exchanging data between the form and a list box. Use of the C# ListArray class and the foreach construct of C#.
Wednesday, October 10: Data validation. (Word file) The Validating event and the ErrorProvider class.
Friday, October 12: Lab on radio buttons and list boxes.
Monday, October 15: Fonts Typeface, size, and style; character sets, glyphs, Ascii, Unicode; raster, stroke, and TrueType fonts; kerning; character and cell height, internal leading and external leading. (Word file).
Wednesday, October 17: : More on Text and Fonts in .NET. (Word file).
Friday, October 19: Lab on fonts (War of the Worlds lab) Use of the StringFormat class.
Monday, October 22:
Wednesday, October 24: Review for the second midterm.
Friday, October 26: Second midterm programming exam.
Monday, October 29 : Introduction to the Windows Common Dialogs. (Word file.) The ColorDialog, and introduction to the OpenFileDialog and SaveFileDialog.
Wednesday, October 31 : Common File Dialogs. (Word file). Details of the SaveFileDialog and OpenFileDialog classes. Disabling Save until Save As is used; filename extensions; filter strings; specifying the initial directory; overwriting files; opening non-existent files; opening network files; checking file permissions; error handling.
Friday, November 2 : Lab on the Windows Common Dialogs. (HTML Editor lab).
Monday, November 5: Responding to the keyboard. (Word file) Key codes and character codes; keyboard layouts; KeyUp, KeyDown, and KeyPress events. The Keys enumeration. Detecting the Alt, Shift, and Ctrl keys. Using arrow, tab, and function keys. The Sudoku example program.
Wednesday, November 7:
Monday, November 12: Veteran's Day holiday, campus closed. No class.
Wednesday, November 14:
Monday, November 19:
Wednesday, November 21:
Friday, November 23: No lab, Thanksgiving vacation.
Monday, November 26:
Wednesday, November 28: Network programming in .NET. (Word file) Sockets. Making a connection. Server and client sockets. The TcpListener and TcpClient classes in .NET. Asynchronous programming. Notes revised Dec. 5, 2007, removing some unnecessary (unused) code in the example. The unused code would be needed to send data, but in this first example, we are only receiving data.
Friday, November 30: (Last lab) You'll build a simple video game, Handball, based on the ideas in the Animation lecture. For this lab, you'll need the file Ball.cs, so download it to your computer in advance.
Monday, December 3: Network programming in .NET continued. (Word file) The TwoWayChat program. Here's a zip file of the interface-only part of TwoWayChat. You can download it as a starting point for building the program. Unpack all the files but the last five in some folder and then unpack the last five in the Properties subfolder of that folder. This way, we won't waste class time on interface programming, and you can still follow along with the network programming.
Wednesday, Dec. 5: We will complete going through the TwoWayChat code and briefly examine NetTicTacToe. The final exam may include some network programming, since we didn't have a programming assignment over that part of the class, but it won't cover NetTicTacToe. Here is a zip file of the NetTicTacToe project. This file was saved with "full path information" to preserve the directory structure so it's expecting to unpack into c:\home\cs130\Examples\NetTicTacToe.
Friday, Dec. 7. Lab on networking.
Monday, Dec. 10: last day of class. Review for the final exam.
Tuesday, December 18, 9:45 a.m. Final Exam