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();
                }
            }
        }
    }
  • 相关阅读:
    完美兼容的纯CSS下拉菜单
    ASP.Net分页控件发布(转)
    ASP.NET(C#)FileUpload实现上传限定类型和大小的文件到服务器
    完美的ASP.NET页面分页控件
    Asp.net上传图片同时生成缩略图和水印图
    狗狗约瑟夫环(链表)
    丹叔链表
    囧囧出的题……他自己都没过(一元多项式之和)
    More is better
    最短路
  • 原文地址:https://www.cnblogs.com/275147378abc/p/4604635.html
Copyright © 2011-2022 走看看