MyCaffe  1.12.2.41
Deep learning software for Windows C# programmers.
DictionaryParamEditor.cs
1using System;
2using System.Collections.Generic;
4using System.Drawing.Design;
5using System.Linq;
6using System.Text;
7using System.Threading.Tasks;
8using System.Windows.Forms.Design;
9
10namespace MyCaffe.param.ui
11{
15 public class DictionaryParamEditor : UITypeEditor
16 {
20 public DictionaryParamEditor() : base()
21 {
22 }
23
29 public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
30 {
31 return UITypeEditorEditStyle.DropDown;
32 }
33
41 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
42 {
43 IWindowsFormsEditorService svc = null;
44
45 if (provider != null)
46 svc = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
47
48 if (svc != null)
49 {
50 DictionaryParameterEditorControl ctrl = new DictionaryParameterEditorControl((string)value, svc);
51 svc.DropDownControl(ctrl);
52 value = ctrl.Value;
53 }
54
55 return value;
56 }
57 }
58}
The DictionaryParamEditor is used to visually edit dictionary based parameters that are stored as a k...
override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
The EditValue displays the editing control and returns the new edited value.
override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
Returns the edit style DROPDOWN