Beispiel #1
0
 private void buttonOK_Click(object sender, EventArgs e)
 {
     ResultItems = EnumTreeViewMenu.None;
     for (int i = 0; i < checkedListBox1.CheckedItems.Count; i++)
     {
         ResultItems |= (EnumTreeViewMenu)checkedListBox1.CheckedItems[i];
     }
     this.DialogResult = DialogResult.OK;
 }
Beispiel #2
0
        public void LoadData(EnumTreeViewMenu items)
        {
            ResultItems = items;
            Array vals = Enum.GetValues(typeof(EnumTreeViewMenu));

            for (int i = 0; i < vals.Length; i++)
            {
                EnumTreeViewMenu v = (EnumTreeViewMenu)vals.GetValue(i);
                if ((v & items) == v)
                {
                    checkedListBox1.Items.Add(v, true);
                }
                else
                {
                    checkedListBox1.Items.Add(v, false);
                }
            }
        }
Beispiel #3
0
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     if (context != null && context.Instance != null && provider != null)
     {
         if (value is EnumTreeViewMenu)
         {
             IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
             if (edSvc != null)
             {
                 EnumTreeViewMenu    n   = (EnumTreeViewMenu)value;
                 DlgEnumTreeViewMenu dlg = new DlgEnumTreeViewMenu();
                 dlg.LoadData(n);
                 if (edSvc.ShowDialog(dlg) == System.Windows.Forms.DialogResult.OK)
                 {
                     value = dlg.ResultItems;
                 }
             }
         }
     }
     return(value);
 }