Menu

[r1537]: / trunk / GoogleContactsSync / GoContactSyncModForm.cs  Maximize  Restore  History

Download this file

51 lines (39 with data), 1.2 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using System.Windows.Forms;
using System.Drawing;
using GoContactSyncMod.Properties;
namespace GoContactSyncMod
{
public class GoContactSyncModForm : Form
{
protected void LoadStateFromSettings()
{
var cn = GetType().Name;
var s = (Size)Settings.Default[cn + "_Window_Size"];
if (s.Width > 0 && s.Height > 0)
{
Size = s;
}
var wa = Screen.FromControl(this).WorkingArea;
if (Width > wa.Width)
{
Width = wa.Width;
}
if (Height > wa.Height)
{
Height = wa.Height;
}
var p = (Point)Settings.Default[cn + "_Window_Location"];
if (p.X >= 0 && p.Y >= 0 && p.X <= wa.Width && p.Y <= wa.Height)
{
Location = p;
}
}
protected void SaveStateToSettings()
{
var cn = GetType().Name;
Settings.Default[cn + "_Window_Size"] = Size;
Settings.Default[cn + "_Window_Location"] = Location;
Settings.Default.Save();
}
}
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.