Ejemplo n.º 1
0
        public override object EditValue(
            ITypeDescriptorContext context,
            IServiceProvider provider, object value)
        {
            // Attempts to obtain an IWindowsFormsEditorService
            IWindowsFormsEditorService edSvc =
                provider.GetService(typeof(IWindowsFormsEditorService))
                as IWindowsFormsEditorService;

            if (edSvc == null)
            {
                return(value);
            }

            // Displays a drop-down control
            StringFormatEdit editForm = new StringFormatEdit(edSvc);

            editForm.Format = value as System.Drawing.StringFormat;
            edSvc.DropDownControl(editForm);

            editForm.Dispose();
            GC.Collect();

            return(editForm.Format);
        }
Ejemplo n.º 2
0
		public override object EditValue(
			ITypeDescriptorContext context,
			IServiceProvider provider, object value) 
		{
			// Attempts to obtain an IWindowsFormsEditorService
			IWindowsFormsEditorService edSvc =
				provider.GetService(typeof(IWindowsFormsEditorService))
					as IWindowsFormsEditorService;
			if (edSvc == null)
				return value;

            // Displays a drop-down control
			StringFormatEdit editForm = new StringFormatEdit(edSvc);
			editForm.Format = value as System.Drawing.StringFormat;
			edSvc.DropDownControl(editForm);

			editForm.Dispose();
			GC.Collect();

			return editForm.Format;
		}