ComponentChangedEventHandler

G

Guest

This is my code :

using System;
using System.Collections;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Drawing;
using System.Drawing.Design;
using System.Windows.Forms;
using System.Reflection;


namespace Nox.Componente
{
/// <summary>
/// Summary description for WizardControl.
/// </summary>


public class WizardControl: Component
{
// Variáveis locais
private WizardPages _Pages;
private TabControl _TabControl;

// Propriedades
[Description("Páginas que formam o assistente.")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public WizardPages Pages
{
get {return _Pages;}
set {_Pages = value;}
}

[Description("Tabcontrol do assistente.")]
public TabControl TabControl
{
get {return _TabControl;}
set {_TabControl = value;}
}

public WizardControl()
{
_Pages = new WizardPages(this);
}

// Metodos de design-time
private IComponentChangeService ChangeService;
public override ISite Site
{
get
{
return base.Site;
}
set
{
if (value == null)
{
ClearChangeNotifications();
return;
}

base.Site = value;

// Clear any component change event handlers.
ClearChangeNotifications();
RegisterChangeNotifications();
}
}

private void ClearChangeNotifications()
{
// O valor ChangeService é nulo quando não estiver em design mode,
// assim como IComponentChangeService só está disponível em design time.
ChangeService =
(IComponentChangeService)GetService(typeof(IComponentChangeService));

if (ChangeService != null)
{
ChangeService.ComponentRemoving -= new
ComponentChangedEventHandler(OnComponentRemoving);
}
}

private void RegisterChangeNotifications()
{
ChangeService =
(IComponentChangeService)GetService(typeof(IComponentChangeService));

if (ChangeService != null)
{
ChangeService.ComponentRemoving += new
ComponentChangedEventHandler(OnComponentRemoving);
}
}

private void OnComponentRemoving(object sender, ComponentEventArgs ce)
{
}

}

}


When I compile, this message is show :

Method 'Nox.Componente.WizardControl.OnComponentRemoving(object,
System.ComponentModel.Design.ComponentEventArgs)' does not match delegate
'void System.ComponentModel.Design.ComponentChangedEventHandler(object,
System.ComponentModel.Design.ComponentChangedEventArgs)'


What is wrong ?
 
R

Ricky Lee

The signature of the OnComponentRemoving() method doesn't match the
signature of the delegate. You have to use ComponentChangedEventArgs instead
of ComponentEventArgs.

-- Ricky Lee
==================================================
^o^ "When all doors are closed, God will open a Windows" ^o^
==================================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top