SaveWindowPosition.zip
Properties
Settings.settings
|
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 SaveWindowPosition
{
/// <summary>
/// Interaction logic for Window1.xaml
/// </summary>
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
var userPrefs = new UserPreferences();
this.Height = userPrefs.WindowHeight;
this.Width = userPrefs.WindowWidth;
this.Top = userPrefs.WindowTop;
this.Left = userPrefs.WindowLeft;
this.WindowState = userPrefs.WindowState;
}
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
var userPrefs = new UserPreferences();
userPrefs.WindowHeight = this.Height;
userPrefs.WindowWidth = this.Width;
userPrefs.WindowTop=this.Top ;
userPrefs.WindowLeft = this.Left;
userPrefs.WindowState = this.WindowState;
userPrefs.Save();
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of use and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.