闪客动漫天地
欢迎 游客 , 注册 | 登录 | 会员 | 界面 | 简洁版本 | 在线 | 帮助
闪客动漫天地论坛

发表新主题 回复该主题
本主题被查看732次, 共1个帖子, 1页, 当前为第1页     选择页数: 1      跳转到第   上一主题   下一主题
标题: Control.Events 属性
注册会员
UID: 309683
来自:
精华: 0
积分: 54
帖子: 54
注册: 2007-6-18 15:03:00
状态: 离线
威望: 0.00
金钱: 12.00 元
只看楼主 2007-06-19 09:15
Control.Events 属性
获取控件的事件处理程序委托列表。此属性为只读。

命名空间:System.Web.UI
程序集:System.Web(在 system.web.dll 中)

语法
Visual Basic(声明)
Protected ReadOnly Property Events As EventHandlerList

Visual Basic(用法)
Dim value As EventHandlerList

value = Me.Events


C#
protected EventHandlerList Events { get; }

C++
protected:
property EventHandlerList^ Events {
    EventHandlerList^ get ();
}

J#
/** @property */
protected EventHandlerList get_Events ()


JScript
protected function get Events () : EventHandlerList





属性值
事件处理程序委托的列表。
备注
此属性属于 EventHandlerList 类型,它使用线性搜索算法在委托列表中查找项。线性搜索算法在处理大量项时是低效的。因此,当列表很大时,使用此属性查找项的速度会很慢。

示例
下面的示例创建一个名为 Click 的事件,当从页面调用此事件时,它向控件的 EventHandlerList 集合中添加或从中删除处理程序。

注意  该示例优化控件如何从该控件维护的事件列表中添加和删除事件。如果您创建自定义控件并想定义事件,请使用与此类似的代码。该技术可以在 C# 中使用,但不能在 Visual Basic 中使用。

C#  复制代码
// Create an event that adds and removes handlers from the
// Control.Events collection when this event is called from
// a participating page.
public event EventHandler Click {
    add {
        Events.AddHandler(EventClick, value);
    }
    remove {
        Events.RemoveHandler(EventClick, value);
    }
}


J#  复制代码
// Create an event that adds and removes handlers from the
// Control.Events collection when this event is called from
// a participating page.



平台
Windows 98、Windows 2000 SP4、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition

.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求。
#1  
发表新主题 回复该主题
本主题被查看732次, 共1个帖子, 1页, 当前为第1页     选择页数: 1      跳转到第







现在的时间是 2008-09-09 01:34:06
沪ICP备05003105号

版权所有 闪客俱乐部  
         Powered by Discuz!NT 1.0.6666    Copyright © 2001-2008 Comsenz Inc.
Processed in 0.128 seconds