Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Subclassing All Base Controls
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00642367
Message ID:
00644615
Vues:
20
Hi David ,

Thanks for your help. I also found another way of doing this..

All you have to do is add make the event public

public event EventHandler Click

then in the OnClick Event i use this code.

It Checks the derived button to see if it has a click event defined. If it has it runs that click event if not it jusrt runs its own event.


if (Click!=null)
{
Click(this,e);
}
MessageBox.Show("base click");



My Base Button Class

using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
using System.Text.RegularExpressions;

namespace CyberlogicBaseButton
{
///
/// Summary description for Class1.
///

public class CyberlogicBaseButton : System.Windows.Forms.Button
{
public event EventHandler Click;
public CyberlogicBaseButton()
{
//
// TODO: Add constructor logic here
//
}
protected override void OnClick(System.EventArgs e)
{

if (Click!=null)
{
Click(this,e);
}
MessageBox.Show("base click");
}


}
}
Fred Besterwitch, MCP

The harder you work. The luckier you get.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform