Export (0) Print
Expand All

ITypeDescriptorFilterService Interface

Provides an interface to modify the set of member descriptors for a component in design mode.

Namespace: System.ComponentModel.Design
Assembly: System (in system.dll)

public interface ITypeDescriptorFilterService
public interface ITypeDescriptorFilterService
public interface ITypeDescriptorFilterService
Not applicable.

The ITypeDescriptorFilterService interface provides an interface that allows modification of the properties, events, and class-level attributes of a component at design time. This modification occurs through the set of descriptors that a component provides through a TypeDescriptor. The type descriptor will query a component's site for the ITypeDescriptorFilterService service and, if it exists, the type descriptor will pass all metadata it has collected to this service. The service can then modify the metadata by adding, removing, and altering existing characteristics of the component.

For example, the properties of a component can be modified through a call to the FilterProperties method. The filter service obtains a dictionary that contains property names and their property descriptors of type PropertyDescriptor. The modifications are implemented using the following logic.

Modification

Implementation

Removal

Delete the corresponding entry in the dictionary.

Addition

Add the appropriate entry to the dictionary.

Alteration

Call existing property descriptor methods, replace the associated property descriptor entry, or replace the entire property key/value pair in the dictionary.

The return value of FilterProperties determines if this set of properties is fixed. If this method returns true, the TypeDescriptor for this component can cache the results. This cache is maintained until either the component is garbage collected or the Refresh method of the type descriptor is called.

Notes to Implementers: To filter the member descriptors exposed by a TypeDescriptor, implement this interface on a component and override the FilterAttributes, FilterEvents, or FilterProperties methods of this class to filter attributes, events, or properties, respectively.

The following code example demonstrates a designer that uses the ITypeDescriptorFilterService to filter the attributes collection of any new or existing Button to add a designer attribute for a new designer before loading or reloading the designer for the button.

To use the example, add the code to a Windows Forms project and load the components from the class library into the Toolbox.

Walkthrough: Automatically Populating the Toolbox with Custom Components
Walkthrough: Automatically Populating the Toolbox with Custom Components
Walkthrough: Automatically Populating the Toolbox with Custom Components
Walkthrough: Automatically Populating the Toolbox with Custom Components
Walkthrough: Automatically Populating the Toolbox with Custom Components

Add some buttons to your form. Add a ButtonDesignerFilterComponent to your form, and it will appear in the component tray. The ButtonDesignerFilterComponent will add a ButtonDesignerFilterService, which implements ITypeDescriptorFilterService, as a design mode service provider. Existing or new Button objects on the form will begin color cycling after the ButtonDesignerFilterService replaces the designer for each existing and new button with a ColorCycleButtonDesigner. The buttons will color cycle when you move the mouse pointer over them, and alternately continue cycling or reset the background and foreground colors on MouseLeave events. New Button objects will be given the ColorCycleButtonDesigner through the FilterAttributes method of the ButtonDesignerFilterService that has been loaded, until the ButtonDesignerFilterComponent is disposed and replaces the original ITypeDescriptorFilterService. The ColorCycleButton class in this example is a Button associated with a ColorCycleButtonDesigner.

using System;
using System.Collections;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.ComponentModel.Design.Serialization;
using System.Drawing;
using System.Reflection;
using System.Timers;
using System.Windows.Forms;
using System.Windows.Forms.Design;

namespace ITypeDescriptorFilterSample
{	
    // Component to host the ButtonDesignerFilterComponentDesigner that loads the 
    // ButtonDesignerFilterService ITypeDescriptorFilterService.
    [Designer(typeof(ButtonDesignerFilterComponentDesigner))]
    public class ButtonDesignerFilterComponent : System.ComponentModel.Component
    {		
        public ButtonDesignerFilterComponent(System.ComponentModel.IContainer container)
        {
            container.Add(this);
        }

        public ButtonDesignerFilterComponent()
        {}
    }

    // Provides a designer that can add a ColorCycleButtonDesigner to each 
    // button in a design time project using the ButtonDesignerFilterService 
    // ITypeDescriptorFilterService.
    public class ButtonDesignerFilterComponentDesigner : System.ComponentModel.Design.ComponentDesigner
    {
        // Indicates whether the service has been loaded.
        private bool serviceloaded = false;		
        // Stores any old ITypeDescriptorFilterService to restore later.
        private ITypeDescriptorFilterService oldservice = null;
        
        public ButtonDesignerFilterComponentDesigner()
        {}
        
        // Loads the new ITypeDescriptorFilterService and reloads the 
        // designers for each button.
        public override void Initialize(System.ComponentModel.IComponent component)
        {
            base.Initialize(component);
            
            // Loads the custom service if it has not been loaded already
            LoadService();
            
            // Build list of buttons from Container.Components.
            ArrayList buttons = new ArrayList();
            foreach(IComponent c in this.Component.Site.Container.Components)
                if(c.GetType() == typeof(System.Windows.Forms.Button))
                    buttons.Add((System.Windows.Forms.Button)c);
            if(buttons.Count > 0)
            {		
                // Tests each Button for an existing 
                // ColorCycleButtonDesigner;
                // if it has no designer of type 
                // ColorCycleButtonDesigner, adds a designer.
                foreach(System.Windows.Forms.Button b in buttons)
                {
                    bool loaddesigner = true;
                    // Gets the attributes for each button.
                    AttributeCollection ac = TypeDescriptor.GetAttributes(b);
                    for(int i=0; i<ac.Count; i++)
                    {
                        // If designer attribute is not for a 
                        // ColorCycleButtonDesigner, adds a new 
                        // ColorCycleButtonDesigner.
                        if( ac[i] is DesignerAttribute )
                        {
                            DesignerAttribute da = (DesignerAttribute)ac[i];
                            if( da.DesignerTypeName.Substring(da.DesignerTypeName.LastIndexOf(".")+1) == "ColorCycleButtonDesigner" )
                                loaddesigner = false;
                        }
                    }
                    if(loaddesigner)
                    {
                        // Saves the button location so that it 
                        // can be repositioned.
                        Point p = b.Location;	
                    
                        // Gets an IMenuCommandService to cut and 
                        // paste control in order to register with 
                        // selection and movement interface after 
                        // designer is changed without reloading.
                        IMenuCommandService imcs = (IMenuCommandService)this.GetService(typeof(IMenuCommandService));
                        if( imcs == null )
                            throw new Exception("Could not obtain IMenuCommandService interface.");							
                        // Gets an ISelectionService to select the 
                        // button so that it can be cut and pasted.
                        ISelectionService iss = (ISelectionService)this.GetService(typeof(ISelectionService));
                        if( iss == null)
                            throw new Exception("Could not obtain ISelectionService interface.");
                        iss.SetSelectedComponents(new IComponent[] { b }, SelectionTypes.Auto);						
                        // Invoke Cut and Paste.
                        imcs.GlobalInvoke(StandardCommands.Cut);
                        imcs.GlobalInvoke(StandardCommands.Paste);							
                        // Regains reference to button from 
                        // selection service.
                        System.Windows.Forms.Button b2 = (System.Windows.Forms.Button)iss.PrimarySelection;
                        iss.SetSelectedComponents(null);							
                        // Refreshes TypeDescriptor properties of 
                        // button to load new attributes from
                        // ButtonDesignerFilterService.
                        TypeDescriptor.Refresh(b2);							
                        b2.Location = p;
                        b2.Focus();
                    }
                }
            }
        }

        // Loads a ButtonDesignerFilterService ITypeDescriptorFilterService 
        // to add ColorCycleButtonDesigner designers to each button.
        private void LoadService()
        {
            // If no custom ITypeDescriptorFilterService is loaded, 
            // loads it now.
            if(!serviceloaded)
            {
                // Stores the current ITypeDescriptorFilterService 
                // to restore later.
                ITypeDescriptorFilterService tdfs = (ITypeDescriptorFilterService)this.Component.Site.GetService(typeof(ITypeDescriptorFilterService));
                if( tdfs != null )								
                    oldservice = tdfs;								
                // Retrieves an IDesignerHost interface to use to 
                // remove and add services.
                IDesignerHost dh = (IDesignerHost)this.Component.Site.GetService(typeof(IDesignerHost));
                if( dh == null )
                    throw new Exception("Could not obtain IDesignerHost interface.");				
                // Removes standard ITypeDescriptorFilterService.
                dh.RemoveService(typeof(ITypeDescriptorFilterService));
                // Adds new custom ITypeDescriptorFilterService.
                dh.AddService(typeof(ITypeDescriptorFilterService), new ButtonDesignerFilterService());				
                serviceloaded = true;
            }
        }
        
        // Removes the custom service and reloads any stored, 
        // preexisting service.
        private void RemoveService()
        {
            IDesignerHost dh = (IDesignerHost)this.GetService(typeof(IDesignerHost));
            if( dh == null )
                throw new Exception("Could not obtain IDesignerHost interface.");
            dh.RemoveService(typeof(ITypeDescriptorFilterService));
            if( oldservice != null )
                dh.AddService(typeof(ITypeDescriptorFilterService), oldservice);
            serviceloaded = false;
        }

        protected override void Dispose(bool disposing)
        {
            if(serviceloaded)
                RemoveService();
        }
    }

    // Provides a TypeDescriptorFilterService to add the 
    // ColorCycleButtonDesigner using a DesignerAttribute.
    public class ButtonDesignerFilterService : System.ComponentModel.Design.ITypeDescriptorFilterService
    {
        public ITypeDescriptorFilterService oldService = null;

        public ButtonDesignerFilterService()
        {}

        public ButtonDesignerFilterService(ITypeDescriptorFilterService oldService_)
        {
            // Stores any previous ITypeDescriptorFilterService to implement service chaining.
            this.oldService = oldService_;
        }

        public bool FilterAttributes(System.ComponentModel.IComponent component, System.Collections.IDictionary attributes)
        {
            if(oldService != null)
                oldService.FilterAttributes(component, attributes);
            
            // Creates a designer attribute to compare its TypeID with the TypeID of existing attributes of the component.
            DesignerAttribute da = new DesignerAttribute(typeof(ColorCycleButtonDesigner));
            // Adds the designer attribute if the attribute collection does not contain a DesignerAttribute of the same TypeID.
            if(component is System.Windows.Forms.Button && attributes.Contains(da.TypeId))
                attributes[da.TypeId]=da;
            return true;
        }

        public bool FilterEvents(System.ComponentModel.IComponent component, System.Collections.IDictionary events)
        {
            if(oldService != null)
                oldService.FilterEvents(component, events);
            return true;
        }

        public bool FilterProperties(System.ComponentModel.IComponent component, System.Collections.IDictionary properties)
        {
            if(oldService != null)
                oldService.FilterProperties(component, properties);
            return true;
        }
    }
    
    // Designer for a Button control which cycles the background color.
    public class ColorCycleButtonDesigner : System.Windows.Forms.Design.ControlDesigner
    {
        private System.Windows.Forms.Timer timer1;
        private Color initial_bcolor, initial_fcolor;
        private int r, g, b;
        private bool ru, gu, bu, continue_;

        public ColorCycleButtonDesigner()
        {						
            timer1 = new System.Windows.Forms.Timer();
            timer1.Interval = 50;
            timer1.Tick += new EventHandler(this.Elapsed);
            ru = true;
            gu = false;
            bu = true;			
            continue_ = false;
            timer1.Start();
        }

        private void Elapsed(object sender, EventArgs e)
        {
            this.Control.BackColor = Color.FromArgb(r%255, g%255, b%255);
            this.Control.Refresh();

            // Updates color.		
            if(ru)
                r+=10;
            else if(r>10) 
                r-=10;
            if(gu)
                g+=10;
            else if(g>10)
                g-=10;
            if(bu)
                b+=10;
            else if(b>10)
                b-=10;

            // Randomly switches direction of color component values.
            Random rand = new Random();
            for(int i=0; i<4; i++)			
                switch(rand.Next(0, 2))
                {
                    case 0:
                        if(ru)
                            ru=false;
                        else
                            ru=true;
                        break;
                    case 1:
                        if(gu)
                            gu=false;
                        else
                            gu=true;
                        break;
                    case 2:
                        if(bu)
                            bu=false;
                        else
                            bu=true;
                        break;
                }

            this.Control.ForeColor = Color.FromArgb((this.Control.BackColor.R+128)%255, (this.Control.BackColor.G+128)%255, (this.Control.BackColor.B+128)%255);
        }

        protected override void OnMouseEnter()
        {
            if(!timer1.Enabled)
            {
                initial_bcolor = this.Control.BackColor;
                initial_fcolor = this.Control.ForeColor;
                r = initial_bcolor.R;
                g = initial_bcolor.G;
                b = initial_bcolor.B;			
                timer1.Start();
            }
        }

        protected override void OnMouseLeave()
        {
            if(!continue_)
            {
                continue_ = true;
                timer1.Stop();
            }
            else
                continue_ = false;
            
            this.Control.BackColor = initial_bcolor;
            this.Control.ForeColor = initial_fcolor;			
        }

        protected override void Dispose(bool disposing)
        {
            timer1.Stop();
            this.Control.BackColor = initial_bcolor;
            this.Control.ForeColor = initial_fcolor;
            base.Dispose(disposing);
        }
    }

    // System.Windows.Forms.Button associated with the ColorCycleButtonDesigner.
    [Designer(typeof(ColorCycleButtonDesigner))]
    public class ColorCycleButton : System.Windows.Forms.Button
    {
        public ColorCycleButton()
        {}
    }
}

package ITypeDescriptorFilterSample;

import System.*;
import System.Collections.*;
import System.ComponentModel.*;
import System.ComponentModel.Design.*;
import System.ComponentModel.Design.Serialization.*;
import System.Drawing.*;
import System.Reflection.*;
import System.Timers.*;
import System.Windows.Forms.*;
import System.Windows.Forms.Design.*;

// Component to host the ButtonDesignerFilterComponentDesigner that loads the 
// ButtonDesignerFilterService ITypeDescriptorFilterService.
/** @attribute Designer(ButtonDesignerFilterComponentDesigner.class)
 */
public class ButtonDesignerFilterComponent
    extends System.ComponentModel.Component
{     
    public ButtonDesignerFilterComponent(System.ComponentModel.
        IContainer container) 
    {
        container.Add(this);
    } //ButtonDesignerFilterComponent
         
    public ButtonDesignerFilterComponent() 
    {
    } //ButtonDesignerFilterComponent
} //ButtonDesignerFilterComponent
      
// Provides a designer that can add a ColorCycleButtonDesigner to each 
// button in a design time project using the ButtonDesignerFilterService 
// ITypeDescriptorFilterService.
public class ButtonDesignerFilterComponentDesigner
    extends System.ComponentModel.Design.ComponentDesigner
{
    // Indicates whether the service has been loaded.
    private boolean serviceLoaded = false;
    // Stores any old ITypeDescriptorFilterService to restore later.
    private ITypeDescriptorFilterService oldService = null;
     
    public ButtonDesignerFilterComponentDesigner()
    {
    } //ButtonDesignerFilterComponentDesigner

    // Loads the new ITypeDescriptorFilterService and reloads the 
    // designers for each button.
    public void Initialize(System.ComponentModel.IComponent component)
        throws Exception
    {
        super.Initialize(component);
        // Loads the custom service if it has not been loaded already
        LoadService();
         
        // Build list of buttons from Container.Components.
        ArrayList buttons =  new ArrayList();
        for(int iCtr = 0; iCtr < this.get_Component().get_Site().
            get_Container().get_Components().get_Count(); iCtr++) {
            
            IComponent c = this.get_Component().get_Site().get_Container().
                get_Components().get_Item(iCtr);
            if(c.GetType().Equals(System.Windows.Forms.
                Button.class.ToType())) {
                buttons.Add((System.Windows.Forms.Button)c);
            }
        }

        if (buttons.get_Count() > 0) {
            // Tests each Button for an existing 
            // ColorCycleButtonDesigner;
            // if it has no designer of type 
            // ColorCycleButtonDesigner, adds a designer.
            for (int iCtr=0; iCtr<buttons.get_Count(); iCtr++ ){                
                System.Windows.Forms.Button b =(System.Windows.
                    Forms.Button) buttons.get_Item(iCtr);
                boolean loadDesigner = true;
                // Gets the attributes for each button.
                AttributeCollection ac = TypeDescriptor.GetAttributes(b);
                for (int i = 0; i < ac.get_Count(); i++) {
                    // If designer attribute is not for a 
                    // ColorCycleButtonDesigner, adds a new 
                    // ColorCycleButtonDesigner.
                    if (ac.get_Item(i) instanceof DesignerAttribute) {
                        DesignerAttribute da = (DesignerAttribute)ac.
                        get_Item(i);

                        if (da.get_DesignerTypeName().Substring((da.
                            get_DesignerTypeName().LastIndexOf(".")+ 1)).
                            Equals("ColorCycleButtonDesigner")) {
                            loadDesigner = false;
                        }
                    }
                }
                if (loadDesigner) {
                    // Saves the button location so that it 
                    // can be repositioned.
                    Point p = b.get_Location();
                    // Gets an IMenuCommandService to cut and 
                    // paste control in order to register with 
                    // selection and movement interface after 
                    // designer is changed without reloading.
                    IMenuCommandService imcs = (IMenuCommandService)(this.
                        GetService(IMenuCommandService.class.ToType()));
                    if (imcs == null) {
                        throw new Exception("Could not obtain" 
                            + "ISelectionService interface.");
                    }
                    // Gets an ISelectionService to select the 
                    // button so that it can be cut and pasted.
                    ISelectionService iss = (ISelectionService)this.
                        GetService(ISelectionService.class.ToType());
                        if (iss == null) {
                            throw new Exception("Could not obtain"
                                + "ISelectionService interface.");
                    }
                    iss.SetSelectedComponents(new IComponent[] {b},
                        SelectionTypes.Normal);
                    
                    // Invoke Cut and Paste.
                    imcs.GlobalInvoke(StandardCommands.Cut);
                    imcs.GlobalInvoke(StandardCommands.Paste);
                    // Regains reference to button from 
                        
                    // selection service.
                    System.Windows.Forms.Button b2 = (System.Windows.
                        Forms.Button)iss.get_PrimarySelection();
                    iss.SetSelectedComponents(null);
                    // Refreshes TypeDescriptor properties of 
                    // button to load new attributes from
                    // ButtonDesignerFilterService.
                    TypeDescriptor.Refresh(b2);
                    b2.set_Location(p);
                    b2.Focus();
                }
            }
        }
    } //Initialize
      
    // Loads a ButtonDesignerFilterService ITypeDescriptorFilterService 
    // to add ColorCycleButtonDesigner designers to each button.
    private void LoadService() throws Exception 
    {
        // If no custom ITypeDescriptorFilterService is loaded, 
        // loads it now.
        if (!(serviceLoaded)) {
            // Stores the current ITypeDescriptorFilterService 
            // to restore later.
            ITypeDescriptorFilterService tdfs =
                (ITypeDescriptorFilterService)(this.get_Component().get_Site().
                GetService(ITypeDescriptorFilterService.class.ToType()));
            if (tdfs != null) {
                oldService = tdfs;
            }
            // Retrieves an IDesignerHost interface to use to 
            // remove and add services.
            IDesignerHost dh = (IDesignerHost) this.get_Component().
                get_Site().GetService(IDesignerHost.class.ToType());
            
            if (dh == null) {
                throw new Exception("Could not obtain IDesignerHost interface.");
            }
            // Removes standard ITypeDescriptorFilterService.
            dh.RemoveService(ITypeDescriptorFilterService.class.ToType());
            // Adds new custom ITypeDescriptorFilterService.
            dh.AddService(ITypeDescriptorFilterService.class.ToType(),
                new ButtonDesignerFilterService());
            serviceLoaded = true;
        }
    } //LoadService
      
    // Removes the custom service and reloads any stored, 
    // preexisting service.
    private void RemoveService() throws Exception 
    {
        IDesignerHost dh 
            = (IDesignerHost)(this.GetService(IDesignerHost.class.ToType()));
        if (dh == null) {
            throw new Exception("Could not obtain IDesignerHost interface.");
        }
        dh.RemoveService(ITypeDescriptorFilterService.class.ToType());
        if (oldService != null) {
            dh.AddService(ITypeDescriptorFilterService.
                class.ToType(),oldService);
        }
        serviceLoaded = false;
    } //RemoveService
      
    protected void Dispose(boolean disposing) throws Exception
    {
        if (serviceLoaded) {
            RemoveService();
        }
    } //Dispose
} //ButtonDesignerFilterComponentDesigner
 
// Provides a TypeDescriptorFilterService to add the 
// ColorCycleButtonDesigner using a DesignerAttribute.
public class ButtonDesignerFilterService
    implements System.ComponentModel.Design.ITypeDescriptorFilterService
{
    public ITypeDescriptorFilterService oldService = null;
    public ButtonDesignerFilterService() 
    {
    } //ButtonDesignerFilterService
    
    public ButtonDesignerFilterService(
        ITypeDescriptorFilterService oldService_) 
    {
        // Stores any previous ITypeDescriptorFilterService to implement 
        //service chaining.
        this.oldService = oldService_;
    } //ButtonDesignerFilterService
     
    public boolean FilterAttributes(System.ComponentModel.IComponent component,
        System.Collections.IDictionary attributes) 
    {
        if (oldService != null ) {
            oldService.FilterAttributes(component, attributes);
        }
         
        // Creates a designer attribute to compare its TypeID with the TypeID
        //of existing attributes of the component.
        DesignerAttribute da = new DesignerAttribute(ColorCycleButtonDesigner
            .class.ToType());
        // Adds the designer attribute if the attribute collection does not
        //contain a DesignerAttribute of the same TypeID.
        if (component instanceof System.Windows.Forms.Button 
            && attributes.Contains(da.get_TypeId())) {
            attributes.set_Item( da.get_TypeId(), da );
        }
        return true ;
    } //FilterAttributes
      
    public boolean FilterEvents(System.ComponentModel.IComponent component,
        System.Collections.IDictionary events) 
    {
        if (oldService != null) {
            oldService.FilterEvents(component, events);
        }
        return true ;
    } //FilterEvents

    public boolean FilterProperties(System.ComponentModel.IComponent component,
        System.Collections.IDictionary properties)    
    {
        if (oldService  != null) {
            oldService.FilterProperties(component, properties);
        }
        return true ;
    } //FilterProperties
} //ButtonDesignerFilterService

// Designer for a Button control which cycles the background color.
public class ColorCycleButtonDesigner
    extends System.Windows.Forms.Design.ControlDesigner
{
    private System.Windows.Forms.Timer timer1;
    private Color initial_bcolor, initial_fcolor;
    private int r, g, b;
    private boolean ru, gu, bu, continue_;
      
    public ColorCycleButtonDesigner()
    {
        timer1 = new System.Windows.Forms.Timer();
        timer1.set_Interval(50);
        timer1.add_Tick(new EventHandler(this.Elapsed));
        ru = true;
        gu = false;
        bu = true;
        continue_ = false;
        timer1.Start();
    } //ColorCycleButtonDesigner
      
    private void Elapsed(Object sender, EventArgs e) 
    {
        this.get_Control().set_BackColor(Color.FromArgb(r % 255,
            g % 255, b % 255));
        this.get_Control().Refresh();
         
        // Updates color.        
        if (ru) {
            r += 10;
        }
        else {
            if (r > 10) {
                r -= 10;
            }
        }
        if( gu) {
            g += 10;
        }
        else {
            if (g > 10) {
                g -= 10;
            }
        }
        if (bu) {
            b += 10;
        }
        else {
            if ( b > 10  ) {
                b -= 10;
            }
        } 
        // Randomly switches direction of color component values.
        Random rand =  new Random();
        for (int i=0; i < 4; i++) {
            switch (rand.Next(0, 2)) {
                case 0 : 
                    if (ru) {
                    ru = false;
                    }
                    else {
                        ru = true;
                    }
                    break;
                case 1 : 
                    if (gu) {
                        gu = false;
                    }
                    else {
                        gu = true;
                    }
                    break;
                case 2 : 
                    if (bu) {
                        bu = false;
                    }
                    else {
                        bu = true;
                    }
                    break;
            }
        }  
        this.get_Control().set_ForeColor(Color.FromArgb((this.get_Control().
            get_BackColor().get_R() + 128) % 255,(this.get_Control().
            get_BackColor().get_G() + 128) % 255,(this.get_Control().
            get_BackColor().get_B() + 128) % 255));
    } //Elapsed
      
    protected void OnMouseEnter() 
    {
        if (!(timer1.get_Enabled())) {
            initial_bcolor = this.get_Control().get_BackColor();
            initial_fcolor = this.get_Control().get_ForeColor();
            r = initial_bcolor.get_R();
            g = initial_bcolor.get_G();
            b = initial_bcolor.get_B();
            timer1.Start();
        }
    } //OnMouseEnter
     
    protected void OnMouseLeave()
    {
        if (!(continue_)) {
            continue_ = true;
            timer1.Stop();
        }
        else {
            continue_ = false;
        } 
        this.get_Control().set_BackColor(initial_bcolor);
        this.get_Control().set_ForeColor(initial_fcolor);
    } //OnMouseLeave
    protected void Dispose(boolean disposing) 
    {
        timer1.Stop();
        this.get_Control().set_BackColor(initial_bcolor);
        this.get_Control().set_ForeColor(initial_fcolor);
        super.Dispose(disposing);
    } //Dispose
} //ColorCycleButtonDesigner
  
// System.Windows.Forms.Button associated with the ColorCycleButtonDesigner.
/** @attribute Designer(ColorCycleButtonDesigner.class)
 */
public class ColorCycleButton extends System.Windows.Forms.Button
{
    public ColorCycleButton() 
    {
    } //ColorCycleButton
} //ColorCycleButton

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft