forked from pripost/NppDB.MSAccess
-
Notifications
You must be signed in to change notification settings - Fork 1
/
MSAccessColumnInfo.cs
44 lines (40 loc) · 1.4 KB
/
MSAccessColumnInfo.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
using System.Drawing;
using System.Windows.Forms;
namespace NppDB.MSAccess
{
public class MSAccessColumnInfo : TreeNode
{
public string ColumnName { get; }
public string ColumnType { get; }
public MSAccessColumnInfo(string columnName, string columnType, int type, int options)
{
NodeFont = new Font("Consolas", 8F, FontStyle.Regular);
ColumnName = columnName;
ColumnType = columnType;
AdjustColumnNameFixedWidth(0);
switch (type)
{
case 1:
SelectedImageKey = ImageKey = "Primary_Key";
break;
case 2:
SelectedImageKey = ImageKey = "Foreign_Key";
break;
case 3:
SelectedImageKey = ImageKey = "Index";
break;
case 4:
SelectedImageKey = ImageKey = "Unique_Index";
break;
default:
// FK, PK, Indexed, Not Null
SelectedImageKey = ImageKey = $"Column_{options:0000}";
break;
}
}
public void AdjustColumnNameFixedWidth(int fixedWidth)
{
Text = ColumnName.PadRight(fixedWidth) + (string.IsNullOrEmpty(ColumnType) ? "" : " " + ColumnType);
}
}
}