示例#1
0
        static void Main()
        {
            Globals.AddCoursesSampleData();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new CourseListForm());
        }
示例#2
0
        public CourseListForm()
        {
            InitializeComponent();

            Globals.AddCoursesSampleData();

            // 2. Add courseListView ItemActivate Event Handler with CourseListView__ItemActivate
            // (this is the Event Handler for the mouse double-click on a row of the ListView)
            // (the ListView control is called this.courseListView)
            // (refer to the Windows Form Controls Word Document in myCourses for the event handler syntax)
            this.courseListView.ItemActivate += new EventHandler(this.CourseListView__ItemActivate);


            // 3. Add courseListView KeyDown Event Handler with CourseListView__KeyDown
            // (this is the Event Handler for pressing Enter on a row of the ListView)
            this.courseListView.KeyDown += new KeyEventHandler(this.CourseListView__KeyDown);


            // 4. Add courseListView SelectedIndexChanged Event Handler with CourseListView__SelectedIndexChanged
            // (this is the Event Handler for using the arrow keys or single-clicking on another row of the ListView)
            this.courseListView.SelectedIndexChanged += new EventHandler(this.CourseListView__SelectedIndexChanged);


            // 5. disable updateButton (using the Enabled property)
            this.updateButton.Enabled = false;


            // 6. disable courseCodeTextBox
            this.courseCodeTextBox.Enabled = false;


            // 7. disable courseDescriptionTextBox
            this.courseDescriptionTextBox.Enabled = false;


            // 8. disable reviewRichTextBox
            this.reviewRichTextBox.Enabled = false;


            // 9. set focus on courseListView by calling the object's Focus() method
            this.Focus();


            this.updateButton.Click += new EventHandler(UpdateButton__Click);
            this.exitButton.Click   += new EventHandler(ExitButton__Click);

            // call PaintListView with null to indicate starting at top of list
            PaintListView(null);
        }