-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathFilterComboBox.cs
85 lines (79 loc) · 1.95 KB
/
FilterComboBox.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
85
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
namespace P4EXP
{
public class FilterComboBox : ComboBox
{
//internal MRUList mruValues { get; set; }
internal bool mruLoaded { get; set; }
public FilterComboBox()
{
mruLoaded = false;
//mruValues = new MRUList(10);
}
public void OnClose(string PreferenceKey)
{
if (PreferenceKey != null)
{
//Preferences.LocalSettings[PreferenceKey] = mruValues;
}
}
public void OnLoad(string PreferenceKey)
{
//if ((PreferenceKey != null) && (Preferences.LocalSettings.ContainsKey(PreferenceKey)))
//{
// MRUList values = Preferences.LocalSettings[PreferenceKey] as MRUList;
// if ((values != null) && (values.Count > 0) && (values[0] != null))
// {
// mruValues = values;
// mruLoaded = true;
// base.Text = mruValues[0] as string;
// }
//}
}
public new string Text
{
get
{
if (base.Text != null)
{
//mruValues.Add(base.Text);
}
return base.Text;
}
set
{
if (string.IsNullOrEmpty(value) == false)
{
//mruValues.Add(value);
}
base.Text = value;
}
}
protected override void OnDropDown(EventArgs e)
{
int widest = DropDownWidth;
base.Items.Clear();
//for (int idx = 0; idx < mruValues.Capacity; idx++)
//{
// if ((mruValues[idx] != null) && (mruValues[idx] is string))
// {
// base.Items.Add(mruValues[idx] as string);
// Image fakeImage = new Bitmap(1,1);
// Graphics graphics = Graphics.FromImage(fakeImage);
// SizeF measure = graphics.MeasureString(mruValues[idx].ToString(), Font);
// if (measure.Width>widest)
// {
// widest = Convert.ToInt32(measure.Width);
// }
// }
//}
DropDownWidth = widest;
base.OnDropDown(e);
}
}
}