コード例 #1
0
 /// <summary>
 /// Overrides the method used to provide basic behaviour for selecting editor.
 /// Shows our custom control for editing the value.
 /// </summary>
 /// <param name="context">The context of the editing control</param>
 /// <param name="provider">A valid service provider</param>
 /// <param name="value">The current value of the object to edit</param>
 /// <returns>The new value of the object</returns>
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     if (context != null &&
         context.Instance != null &&
         provider != null)
     {
         edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
         if (edSvc != null)
         {
             editor = new TreeListViewItemsEditorForm((TreeListViewItemCollection)value);
             edSvc.ShowDialog(editor);
             if (editor.DialogResult == DialogResult.OK)
             {
                 return(editor.Items);
             }
         }
     }
     return(value);
 }
コード例 #2
0
		/// <summary>
		/// Overrides the method used to provide basic behaviour for selecting editor.
		/// Shows our custom control for editing the value.
		/// </summary>
		/// <param name="context">The context of the editing control</param>
		/// <param name="provider">A valid service provider</param>
		/// <param name="value">The current value of the object to edit</param>
		/// <returns>The new value of the object</returns>
		public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) 
		{
			if (context != null
				&& context.Instance != null
				&& provider != null) 
			{
				edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
				if(edSvc != null)
				{
					editor = new TreeListViewItemsEditorForm((TreeListViewItemCollection) value);
					edSvc.ShowDialog(editor);
					if(editor.DialogResult == DialogResult.OK)
						return(editor.Items);
				}
			}
			return(value);
		}