MainForm.cs
上传用户:linger1010
上传日期:2008-12-08
资源大小:561k
文件大小:2k
源码类别:

Windows Mobile

开发平台:

C#

  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Text;
  7. using System.Windows.Forms;
  8. using Microsoft.WindowsCE.Forms;
  9. namespace DealWithScreenOrientation
  10. {
  11. public partial class MainForm : Form
  12. {
  13. public MainForm()
  14. {
  15. InitializeComponent();
  16. }
  17. private void m_mnuExit_Click(object sender, EventArgs e)
  18. {
  19. this.Close();
  20. }
  21. private void m_mnuEdit_Click(object sender, EventArgs e)
  22. {
  23. if(m_lstBooks.SelectedIndices.Count != 0)
  24. (new EditForm(m_lstBooks.SelectedIndices[0])).Show();
  25. }
  26. private void MainForm_Activated(object sender, EventArgs e)
  27. {
  28. m_loadBooks();
  29. }
  30. private void m_loadBooks()
  31. {
  32. m_lstBooks.Items.Clear();
  33. foreach(BookInfo bi in BookInfo.Books)
  34. {
  35. ListViewItem item = new ListViewItem(
  36. new string[]
  37. {
  38. bi.ISBN,
  39. bi.Title,
  40. bi.Author,
  41. bi.Publisher,
  42. bi.Price.ToString("0.00")
  43. });
  44. m_lstBooks.Items.Add(item);
  45. }
  46. }
  47. private void m_cmbRotate_SelectedIndexChanged(object sender, EventArgs e)
  48. {
  49. switch(m_cmbRotate.SelectedIndex)
  50. {
  51. case 0:  // 0
  52. SystemSettings.ScreenOrientation = ScreenOrientation.Angle0;
  53. break;
  54. case 1:  // 90
  55. SystemSettings.ScreenOrientation = ScreenOrientation.Angle90;
  56. break;
  57. case 2:  // 180
  58. SystemSettings.ScreenOrientation = ScreenOrientation.Angle180;
  59. break;
  60. case 3:  // 270
  61. SystemSettings.ScreenOrientation = ScreenOrientation.Angle270;
  62. break;
  63. }
  64. }
  65. }
  66. }