zoukankan      html  css  js  c++  java
  • WPF第一堂课,以及Grid布局

    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.Navigation;
    using System.Windows.Shapes;
    
    namespace WpfApplication1
    {
        /// <summary>
        /// MainWindow.xaml 的交互逻辑
        /// </summary>
        public partial class MainWindow : Window
        {
            public MainWindow()  //按照配置文件吧窗口初始化
            {
                InitializeComponent();
                this.WindowState = Properties.Settings.Default.MainWindowState; //给窗口赋值配置文件的内容
                Rect rect = Properties.Settings.Default.MainWindowRect;  //描述一个矩形宽度,高度和未知的类
    
                this.Top = rect.Top;
                this.Left = rect.Left;
                this.Width = rect.Width;
                this.Height = rect.Height;
            }
            //点击关闭时在配置文件里记录关闭的位置
            private void Window_Closing_1(object sender, System.ComponentModel.CancelEventArgs e)
            {
                Properties.Settings.Default.MainWindowState = this.WindowState;
                Properties.Settings.Default.MainWindowRect = this.RestoreBounds;
                Properties.Settings.Default.Save();
                //e.Cancel = true;
    
                if (w!=null)
                {
                    w.Close();
                }
            }
            Window1 w;
            private void Button_Click_1(object sender, RoutedEventArgs e)  //点击打开新窗口
            {
                if (w == null)
                {
                    w = new Window1();
                    w.Show();
                }
                else
                {
                    w.Show();
                }
            }
    
            private void Button_Click_2(object sender, RoutedEventArgs e)  //点击隐藏新窗口
            {
                if (w!=null)
                {
                    w.Hide();
                }
            }
        }
    }
  • 相关阅读:
    [stm32] Systick
    [stm32] GPIO及最小框架
    51单片机-PC数据传输 温度 距离 监控系统设计
    [游戏学习29] Win32 图像处理1
    [51单片机] 串口通讯 简单通信
    [汇编] 闰年计算
    Java常用工具类之ArrayUtil
    常用工具类系列之DateUtil
    SpringBoot 获取当前登录用户IP
    Spring data jpa Specification查询关于日期的范围搜索
  • 原文地址:https://www.cnblogs.com/275147378abc/p/4604635.html
Copyright © 2011-2022 走看看