/*
* 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;
}
}
}
}
* 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;
}
}
}
}