zoukankan      html  css  js  c++  java
  • 写的wpf的第一个窗口类

    /*  
     * User: Administrator
     * Date: 2007-11-16 Time: 14:54
     
    */

    using System;
    using System.Windows;
    using System.Windows.Input;


    namespace wpftest
    {
        
    /// <summary>
        
    /// Description of cxyWin.
        
    /// </summary>
        public class cxyWin:Window
        {
            
    public cxyWin()
            {
                Title
    ="grow and shrink test";
                WindowStartupLocation
    = WindowStartupLocation.CenterScreen;
                Height
    =400;
                Width
    =400;
                
    this.WindowStyle= WindowStyle.ThreeDBorderWindow;//显示控件按钮
                
    //this.ResizeMode= ResizeMode.NoResize;//禁止resize
                this.WindowState= WindowState.Maximized;//窗口状态
            }
            
            
    protected override void OnTextInput(TextCompositionEventArgs e)
            {
                
    //在输入字符串时,显示输入的字符串在标题栏上
                base.OnTextInput(e);
                
    if(e.Text=="\b" && Title.Length>0)//回退字符时删除字符
                {
                    Title
    =Title.Substring(0,Title.Length-1);
                    
                }
                
    else if(!char.IsControl(e.Text[0]))
                {
                    Title
    =Title+e.Text;
                }
            }
            
            
    protected override void OnKeyDown(KeyEventArgs e)
            {
                
    base.OnKeyDown(e);
                
    //调整窗口的位置,可以多加代码调整窗体的大小
                 
                
    if(e.Key== Key.Up)
                {
                    Left
    -=Width*0.05;
                    Top
    -=Height*0.05;                
                     
                }
                
    if(e.Key== Key.Down)
                {
                    Left
    +=Width*0.05;
                    Top
    +=Height*0.05;
                }
         
            }
            
        }
    }
  • 相关阅读:
    sprint 1 的总结
    2016-11-23(第十天)
    2016-11-22(第九天)
    2016-11-20(第七天)
    2016-11-19(第六天)
    2016-11-18(第五天)
    sprint1_11.15燃尽图(第二天)
    OrderSys---Spring 计划(第一天)
    团队信息
    Scrum 4.0
  • 原文地址:https://www.cnblogs.com/sunbingzibo/p/961701.html
Copyright © 2011-2022 走看看