📄 mainform.cs
字号:
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;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -