Chapter 2 - Control Basics

function OpenWin(url, w, h) { if(!w) w = 400; if(!h) h = 300; window.open(url, "_new", "width=" + w + ",height=" + h + ",menubar=no,toobar=no,scrollbars=yes", true); }

IN THIS CHAPTER

  • Control Base Classes

  • Properties

  • Events

  • The IconButton Control

  • Testing the IconButton Control

Controls provide a means for user interaction with an application. Every control defines a set of properties, events, and a user interface that represents the control and the intended use the control has. Control development consists of two parts: runtime and design-time. Runtime has to do with how the control looks and acts during the execution of the application, whereas design-time refers to the WYSIWYG editor used by VS .NET to create an application. In this chapter the runtime aspect of control development is the focus; Chapter 3, "Designer Basics," covers the design-time aspects of control development.

This chapter covers the basics for creating a simple button control the IconButton control. The IconButton control allows an Icon image to be displayed along with the standard text found on the Windows Forms button control (see Figure 2.1).

Figure 2.1. The IconButton control.

figure 2.1. the iconbutton control.

The IconButton control is a custom control. To build it, you need to understand the following topics:

  • Control base classes

  • Properties

  • Events

The process of developing custom controls is the same as that of developing a set of classes. The process begins by determining the required functionality and the necessary classes that will be responsible for implementing the functionality. In addition, it is necessary to determine the proper base class for the custom control. Each class can inherit from a base class and implements zero or more interfaces. Classes also provide properties and even events. As you'll see in the following sections, custom controls behave much like classes do.



    .NET Windows Forms Custom Controls
    User Interfaces in VB .NET: Windows Forms and Custom Controls
    ISBN: 1590590449
    EAN: 2147483647
    Year: 2002
    Pages: 74

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net