using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace MyNotepad
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }


        private void miNew_Click(object sender, RoutedEventArgs e)
        {
            MessageBox.Show("你按下了新建文件的按钮!");
        }

        private void miOpen_Click(object sender, RoutedEventArgs e)
        {
            MessageBox.Show("你按下了打开文件的按钮!");
        }

        private void miSave_Click(object sender, RoutedEventArgs e)
        {
            MessageBox.Show("你按下了保存文件的按钮!");
        }

        private void miExit_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            ////设置每个字体选单项目所表示的字体大小
            miBiggest.Tag = 24;
            miBig.Tag = 18;
            miNormal.Tag = 14;
            miSmall.Tag = 10;
            miSmallest.Tag = 7;

            //默认选取“正常”字体选项
            miNormal.IsChecked = true;

        }


        private void miBiggest_Checked(object sender, RoutedEventArgs e)
        {
            //从Tag属性取出“特大”字体的大小
            txtEditor.FontSize = (int)miBiggest.Tag;

            //清除其他字体大小选项的核选状态
            miBig.IsChecked = false;
            miNormal.IsChecked = false;
            miSmall.IsChecked = false;
            miSmallest.IsChecked = false;
        }

        private void miBig_Checked(object sender, RoutedEventArgs e)
        {
            //从Tag属性取出“大”字体的大小
            txtEditor.FontSize = (int)miBig.Tag;

            //清除其他字体大选项的核选状态
            miBiggest.IsChecked = false;
            miNormal.IsChecked = false;
            miSmall.IsChecked = false;
            miSmallest.IsChecked = false;
        }

        private void miNormal_Checked(object sender, RoutedEventArgs e)
        {
            //从Tag属性取出“正常”字体的大小
            txtEditor.FontSize = (int)miNormal.Tag;

            //清除其他字体大小选项的核选状态
            miBiggest.IsChecked = false;
            miBig.IsChecked = false;
            miSmall.IsChecked = false;
            miSmallest.IsChecked = false;
        }

        private void miSmall_Checked(object sender, RoutedEventArgs e)
        {
            //从Tag属性取出”小”字体的大小
            txtEditor.FontSize = (int)miSmall.Tag;

            //清除其他字体大小选项的核选状态
            miBiggest.IsChecked = false;
            miBig.IsChecked = false;
            miNormal.IsChecked = false;
            miSmallest.IsChecked = false;
        }

        private void miSmallest_Checked(object sender, RoutedEventArgs e)
        {
            //从Tag属性取出“最小”字体的大小
            txtEditor.FontSize = (int)miSmallest.Tag;

            //清除其他字体大小选项的核选状态
            miBiggest.IsChecked = false;
            miBig.IsChecked = false;
            miNormal.IsChecked = false;
            miSmall.IsChecked = false;
        }
    }
}
