例如:
class A :Control
{
    public int Pty1
   {get...;set...;}    public int Pty2
   {get...;set...;}
}

解决方案 »

  1.   

    class ***:XXX,X:需继承的控件类。
      

  2.   

    一個從Label繼承的控件:
    using System;
    using System.Collections;
    using System.ComponentModel;
    using System.Drawing;
    using System.Data;
    using System.Windows.Forms;
    using System.Timers;namespace OYAMA
    {
    /// <summary>
    /// Summary description for UserControl1.
    /// </summary>
    public class ImgLable : System.Windows.Forms.Label
    {

    private System.Windows.Forms.ImageList imageList1;
    private System.Windows.Forms.ToolTip toolTip1;
    private System.ComponentModel.IContainer components; public ImgLable()
    {
    InitializeComponent(); } /// <summary>
    /// 設置狀態:0起點,1中間點,2終點,3當前點
    /// </summary>
    /// <param name="Status"></param>
    public void SetStatus(string Status)
    {
    //設置圖片
    int ImgIndex=0;
    switch (Status)
    {
    case "start":ImgIndex=0;SetToolTip("初始審批點");
    break;
    case "middle":ImgIndex=1;SetToolTip("審批中");
    break;
    case "end":ImgIndex=2;SetToolTip("終點");
    break;
    case "wait":ImgIndex=3;SetToolTip("當前審批點");
    break;
    }
    this.ImageIndex=ImgIndex;
    this.Visible=true;
    }
    /// <summary>
    /// Clean up any resources being used.
    /// </summary>
    protected override void Dispose( bool disposing )
    {
    if( disposing )
    {
    if( components != null )
    components.Dispose();
    }
    base.Dispose( disposing );
    } #region Component Designer generated code
    /// <summary>
    /// Required method for Designer support - do not modify 
    /// the contents of this method with the code editor.
    /// </summary>
    private void InitializeComponent()
    {
    this.components = new System.ComponentModel.Container();
    System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(ImgLable));
    this.imageList1 = new System.Windows.Forms.ImageList(this.components);
    this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
    // 
    // imageList1
    // 
    this.imageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
    this.imageList1.ImageSize = new System.Drawing.Size(32, 32);
    this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
    this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
    // 
    // ImgLable
    // 
    this.ImageList = this.imageList1;
    this.Size = new System.Drawing.Size(32, 32);
    this.Click += new System.EventHandler(this.lblImage_Click); }
    #endregion
    //設置樣式
    private void lblImage_Click(object sender, System.EventArgs e)
    {
    this.BorderStyle=BorderStyle.Fixed3D;
    }

    //設置樣式
    protected override void OnMouseEnter ( System.EventArgs e )
    {
    this.BorderStyle=BorderStyle.FixedSingle;
    base.OnMouseEnter(e);
    }

    //設置樣式
    protected override void OnMouseLeave ( System.EventArgs e )
    {
    this.BorderStyle=BorderStyle.None;
    base.OnMouseLeave(e);
    } //閃爍
    public void ImgFlash()
    {
    System.Timers.Timer aTimer=new System.Timers.Timer();
    aTimer.Elapsed += new System.Timers.ElapsedEventHandler(OnTimer);
    aTimer.Interval=500;
    aTimer.Enabled=true;
    }
    private void OnTimer(Object sender, ElapsedEventArgs e)

    this.ImageIndex=0;
    } /// <summary>
    /// 設置提示信息
    /// </summary>
    /// <param name="msg">信息內容</param>
    public void SetToolTip(string msg)
    {
    toolTip1.SetToolTip(this,msg);
    }
    }
    }
      

  3.   

    你又不谦虚了.上面就是最通用的例子.WINDOWS的控件都是由它来做接口的.