mirror of
https://github.com/LorenzCK/OnTopReplica.git
synced 2024-06-03 11:04:32 +12:00
8ab1cfd784
Changed position context menu: now locks on a screen position and keeps it after moving/resizing. Some bugfixes and code refactoring.
64 lines
1.1 KiB
C#
64 lines
1.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using System.Xml.Serialization;
|
|
using System.Drawing;
|
|
|
|
namespace OnTopReplica {
|
|
|
|
[Serializable]
|
|
public class StoredRegion : IXmlSerializable {
|
|
|
|
public StoredRegion() {
|
|
}
|
|
|
|
public StoredRegion(Rectangle r, string n) {
|
|
Bounds = r;
|
|
Name = n;
|
|
}
|
|
|
|
public Rectangle Bounds {
|
|
get;
|
|
set;
|
|
}
|
|
|
|
public string Name {
|
|
get;
|
|
set;
|
|
}
|
|
|
|
public override string ToString() {
|
|
return Name;
|
|
}
|
|
|
|
|
|
#region IXmlSerializable Members
|
|
|
|
public System.Xml.Schema.XmlSchema GetSchema() {
|
|
return null;
|
|
}
|
|
|
|
public void ReadXml(System.Xml.XmlReader reader) {
|
|
if (reader.MoveToAttribute("name"))
|
|
Name = reader.Value;
|
|
else
|
|
throw new Exception();
|
|
|
|
reader.Read();
|
|
|
|
XmlSerializer x = new XmlSerializer(typeof(Rectangle));
|
|
Bounds = (Rectangle)x.Deserialize(reader);
|
|
}
|
|
|
|
public void WriteXml(System.Xml.XmlWriter writer) {
|
|
writer.WriteAttributeString("name", Name);
|
|
|
|
XmlSerializer x = new XmlSerializer(typeof(Rectangle));
|
|
x.Serialize(writer, Bounds);
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
|
|
}
|