O'Reilly logo

Microsoft® .NET Compact Framework (Core Reference) by Mark Sutton, Rory MacLoed, Robert Burbidge, Stephen Wheelwright, Andy Wigley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding Custom Events: SlideShow

The following example is a "slide show" component into which a number of images can be loaded and then displayed in sequence. The control is called SlideShow. It contains two private variables: pics to hold an ArrayList object containing Image references, and pos to hold the current position in the slide show.

public class SlideShow : System.Windows.Forms.Control
{
    private ArrayList              pics;
    private int                    pos;
    ⋮
}

These variables are given suitable initial values in the control’s constructor.

public SlideShow()
{
    pics = new ArrayList();
    pos  = 0;
    ⋮
}

The public method AddImage allows the user of the control to add an image reference, which is added to the list held ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required