-
Notifications
You must be signed in to change notification settings - Fork 0
/
DataGridViewDataWindowColumn.cs
84 lines (73 loc) · 2.01 KB
/
DataGridViewDataWindowColumn.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Design;
namespace 巧用_ToolStripControlHost_自定义WinForm右键菜单
{
public class DataGridViewDataWindowColumn:DataGridViewColumn
{
private object m_dataSoruce = null;
private string sDisplayMember = "";
private string sDisplayField = "";
private string sKeyWords = "";
public string SDisplayField
{
get { return sDisplayField; }
set { sDisplayField = value; }
}
public string SDisplayMember
{
get { return sDisplayMember; }
set { sDisplayMember = value; }
}
public string SKeyWords
{
get { return sKeyWords; }
set { sKeyWords = value; }
}
public DataGridViewDataWindowColumn()
: base(new DataGridViewDataWindowCell())
{
}
public override DataGridViewCell CellTemplate
{
get
{
return base.CellTemplate;
}
set
{
if (value != null && !value.GetType().IsAssignableFrom(typeof(DataGridViewDataWindowCell)))
{
throw new InvalidCastException("不是DataGridViewDataWindowCell");
}
base.CellTemplate = value;
}
}
private DataGridViewDataWindowCell ComboBoxCellTemplate
{
get
{
return (DataGridViewDataWindowCell)this.CellTemplate;
}
}
public Object DataSource
{
get
{
return m_dataSoruce;
}
set
{
if (ComboBoxCellTemplate != value)
{
m_dataSoruce = value;
}
}
}
}
}