Beispiel #1
0
        public override object EditValue(ITypeDescriptorContext context,
                                         IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService srv = null;

            // Get the editor service from the provider,
            // which you need to perform the drop-down.
            if (provider != null)
            {
                srv = (IWindowsFormsEditorService)
                      provider.GetService(typeof(IWindowsFormsEditorService));
            }

            if (srv != null)
            {
                // Create an instance of the custom Windows Forms
                // color-picking control.
                // Pass the current value of the color.
                ColorTypeEditorControl editor =
                    new ColorTypeEditorControl((System.Drawing.Color)value,
                                               context.Instance as WebControl);

                // Show the control.
                srv.DropDownControl(editor);

                // Return the selected color information.
                return(editor.SelectedColor);
            }
            else
            {
                // Return the current value.
                return(value);
            }
        }
Beispiel #2
0
		public override object EditValue(ITypeDescriptorContext context, 
			IServiceProvider provider, object value)
		{
			IWindowsFormsEditorService srv = null;
				
			// Get the editor service from the provider,
			// which you need to perform the drop-down.
			if (provider != null)
				srv = (IWindowsFormsEditorService)
					provider.GetService(typeof(IWindowsFormsEditorService));
		
			if (srv != null)
			{
				// Create an instance of the custom Windows Forms
				// color-picking control.
				// Pass the current value of the color.
				ColorTypeEditorControl editor = 
					new ColorTypeEditorControl((System.Drawing.Color)value, 
					context.Instance as WebControl);

				// Show the control.
				srv.DropDownControl(editor);

				// Return the selected color information.
				return editor.SelectedColor;
			}
			else
			{
				// Return the current value.
				return value;
			}
		}