This repository has been archived by the owner on Sep 11, 2023. It is now read-only.
/
Form1.cs
58 lines (48 loc) · 1.48 KB
/
Form1.cs
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
51
52
53
54
55
56
57
58
using System;
using System.Windows.Forms;
namespace Serialization
{
public partial class Form1 : Form
{
object customValue = null;
public Form1()
{
InitializeComponent();
}
private void simpleButton1_Click(object sender, EventArgs e)
{
colID.Tag = "1234556789";
myGridView1.SaveLayoutToXml("C:\\1\\1.xml");
}
private void Form1_Load(object sender, EventArgs e)
{
this.carsTableAdapter.Fill(this.carsDBDataSet.Cars);
}
private void myGridView1_SerializeCustomProperties(object sender, SerializeCustomPropertiesEventArgs e)
{
if ( e.SerializationObject == colID )
e.PropertyNames = new string[] { "ABC", "123", "Tag" };
}
private void simpleButton2_Click(object sender, EventArgs e)
{
myGridView1.RestoreLayoutFromXml("C:\\1\\1.xml");
if ( customValue != null )
labelControl1.Text = customValue.ToString();
}
private void myGridView1_DeserializeCustomProperties(object sender, SerializeCustomPropertiesEventArgs e)
{
if ( e.SerializationObject == colID )
e.PropertyNames = new string[] { "ABC", "123", "Tag" };
}
private void myGridView1_SetCustomPropertyValue(object sender, CustomPropertyValueEventArgs e)
{
if ( e.SerializationObject == colID && e.PropertyName == "ABC" )
e.PropertyValue = 123.456;
}
private void myGridView1_GetCustomPropertyValue(object sender, CustomPropertyValueEventArgs e)
{
if ( e.SerializationObject == colID && e.PropertyName == "ABC" )
customValue = e.PropertyValue;
}
}
}