コード例 #1
0
        /*
         * EditValue
         */

        /// <summary>
        /// Edits the specified object's value using the editor style indicated by the <see cref="M:System.Drawing.Design.UITypeEditor.GetEditStyle"></see> method.
        /// </summary>
        /// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext"></see> that can be used to gain additional context information.</param>
        /// <param name="provider">An <see cref="T:System.IServiceProvider"></see> that this editor can use to obtain services.</param>
        /// <param name="value">The object to edit.</param>
        /// <returns>
        /// The new value of the object. If the value of the object has not changed, this should return the same object it was passed.
        /// </returns>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (context != null && context.Instance != null && provider != null)
            {
                IWindowsFormsEditorService editorService = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
                NuGenToolTipInfo           tooltipInfo   = value as NuGenToolTipInfo;

                if (tooltipInfo == null)
                {
                    tooltipInfo = new NuGenToolTipInfo();
                }

                if (editorService != null)
                {
                    using (NuGenToolTipInfoEditorUI editorUI = new NuGenToolTipInfoEditorUI(
                               this.ServiceProvider,
                               tooltipInfo,
                               new NuGenCustomTypeEditorServiceContext(context.Container, provider))
                           )
                    {
                        if (editorService.ShowDialog(editorUI) == DialogResult.OK)
                        {
                            tooltipInfo = editorUI.GetTooltipInfoFromState();
                        }
                    }

                    return(tooltipInfo);
                }
            }

            return(value);
        }
コード例 #2
0
		/*
		 * EditValue
		 */

		/// <summary>
		/// Edits the specified object's value using the editor style indicated by the <see cref="M:System.Drawing.Design.UITypeEditor.GetEditStyle"></see> method.
		/// </summary>
		/// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext"></see> that can be used to gain additional context information.</param>
		/// <param name="provider">An <see cref="T:System.IServiceProvider"></see> that this editor can use to obtain services.</param>
		/// <param name="value">The object to edit.</param>
		/// <returns>
		/// The new value of the object. If the value of the object has not changed, this should return the same object it was passed.
		/// </returns>
		public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
		{
			if (context != null && context.Instance != null && provider != null)
			{
				IWindowsFormsEditorService editorService = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
				NuGenToolTipInfo tooltipInfo = value as NuGenToolTipInfo;

				if (tooltipInfo == null)
				{
					tooltipInfo = new NuGenToolTipInfo();
				}

				if (editorService != null)
				{
					using (NuGenToolTipInfoEditorUI editorUI = new NuGenToolTipInfoEditorUI(
						this.ServiceProvider,
						tooltipInfo,
						new NuGenCustomTypeEditorServiceContext(context.Container, provider))
						)
					{
						if (editorService.ShowDialog(editorUI) == DialogResult.OK)
						{
							tooltipInfo = editorUI.GetTooltipInfoFromState();
						}
					}
					
					return tooltipInfo;
				}
			}

			return value;
		}