⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.cs

📁 清华大学出版社出版的 移动应用开发宝典 张大威(2008)的附书源代码
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using Microsoft.WindowsCE.Forms;


namespace KioskApplication
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void UpdateFullScreen()
        {
            KioskLibrary.Kiosk.FullScreen(this, chkStart.Checked, chkTaskbar.Checked, chkSip.Checked);
        }

        private void chkStart_CheckStateChanged(object sender, EventArgs e)
        {
            UpdateFullScreen();
        }

        private void chkTaskbar_CheckStateChanged(object sender, EventArgs e)
        {
            UpdateFullScreen();
        }

        private void chkSip_CheckStateChanged(object sender, EventArgs e)
        {
            UpdateFullScreen();
        }

        private void Form1_GotFocus(object sender, EventArgs e)
        {
            UpdateFullScreen();
        }

        private void Form1_LostFocus(object sender, EventArgs e)
        {
            UpdateFullScreen();
        }



        private void ShowHelp()
        {
            Help.ShowHelp(this, "Kiosk.htm");
        }
        private void Form1_HelpRequested(object sender, HelpEventArgs hlpevent)
        {
            ShowHelp();
        }

        private void mnuHelp_Click(object sender, EventArgs e)
        {
            ShowHelp();
        }

        private void mnuMessage_Click(object sender, EventArgs e)
        {
            MessageBox.Show("This demonstrates the main window losing focus", "Popup", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1);
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            hardwareButton1.AssociatedControl = this;
            hardwareButton1.HardwareKey = HardwareKeys.ApplicationKey1;
            hardwareButton2.AssociatedControl = this;
            hardwareButton2.HardwareKey = HardwareKeys.ApplicationKey2;
            hardwareButton3.AssociatedControl = this;
            hardwareButton3.HardwareKey = HardwareKeys.ApplicationKey3;
            hardwareButton4.AssociatedControl = this;
            hardwareButton4.HardwareKey = HardwareKeys.ApplicationKey4;
            hardwareButton5.AssociatedControl = this;
            hardwareButton5.HardwareKey = HardwareKeys.ApplicationKey5;
            hardwareButton6.AssociatedControl = this;
            hardwareButton6.HardwareKey = HardwareKeys.ApplicationKey6;

        }

        private void Form1_KeyDown(object sender, KeyEventArgs e)
        {
            switch ((HardwareKeys)e.KeyCode)
            {
                case HardwareKeys.ApplicationKey1:
                    MessageBox.Show("Hardware Key 1");
                    break;
                case HardwareKeys.ApplicationKey2:
                    MessageBox.Show("Hardware Key 2");
                    break;
                case HardwareKeys.ApplicationKey3:
                    MessageBox.Show("Hardware Key 3");
                    break;
                case HardwareKeys.ApplicationKey4:
                    MessageBox.Show("Hardware Key 4");
                    break;
                case HardwareKeys.ApplicationKey5:
                    MessageBox.Show("Hardware Key 5");
                    break;
                case HardwareKeys.ApplicationKey6:
                    MessageBox.Show("Hardware Key 6");
                    break;
            }

        }

        private void Form1_Closed(object sender, EventArgs e)
        {
            hardwareButton1.AssociatedControl = null;
            hardwareButton2.AssociatedControl = null;
            hardwareButton3.AssociatedControl = null;
            hardwareButton4.AssociatedControl = null;
            hardwareButton5.AssociatedControl = null;
            hardwareButton6.AssociatedControl = null;
        }

        private void chkMaximized_CheckStateChanged(object sender, EventArgs e)
        {
            if (chkMaximized.Checked)
            {
                this.WindowState = FormWindowState.Maximized;
                this.Menu = null;
            }
            else
            {
                this.WindowState = FormWindowState.Normal;
                this.Menu = mainMenu1;
            }
        }      

        
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -