MainForm.cs
上传用户:linger1010
上传日期:2008-12-08
资源大小:561k
文件大小:2k
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Text;
- using System.Windows.Forms;
- using Microsoft.WindowsCE.Forms;
- namespace DealWithScreenOrientation
- {
- public partial class MainForm : Form
- {
- public MainForm()
- {
- InitializeComponent();
- }
- private void m_mnuExit_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- private void m_mnuEdit_Click(object sender, EventArgs e)
- {
- if(m_lstBooks.SelectedIndices.Count != 0)
- (new EditForm(m_lstBooks.SelectedIndices[0])).Show();
- }
- private void MainForm_Activated(object sender, EventArgs e)
- {
- m_loadBooks();
- }
- private void m_loadBooks()
- {
- m_lstBooks.Items.Clear();
- foreach(BookInfo bi in BookInfo.Books)
- {
- ListViewItem item = new ListViewItem(
- new string[]
- {
- bi.ISBN,
- bi.Title,
- bi.Author,
- bi.Publisher,
- bi.Price.ToString("0.00")
- });
- m_lstBooks.Items.Add(item);
- }
- }
- private void m_cmbRotate_SelectedIndexChanged(object sender, EventArgs e)
- {
- switch(m_cmbRotate.SelectedIndex)
- {
- case 0: // 0
- SystemSettings.ScreenOrientation = ScreenOrientation.Angle0;
- break;
- case 1: // 90
- SystemSettings.ScreenOrientation = ScreenOrientation.Angle90;
- break;
- case 2: // 180
- SystemSettings.ScreenOrientation = ScreenOrientation.Angle180;
- break;
- case 3: // 270
- SystemSettings.ScreenOrientation = ScreenOrientation.Angle270;
- break;
- }
- }
- }
- }