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 ...

Get Microsoft® .NET Compact Framework (Core Reference) now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.