All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
PHP安全基础,注射基础经验技巧汇总篇_php资料_编程技术
C#,DataGridView隔行显示不同的颜色_.net资料_编程技术
如何在IE右键菜单中添加菜单项以及如何添加IE任务栏按钮_.net资料_编程技术
查询数据库中重复记录的方法_[SQL Server教程]
用动态网页技术PHP生成验证码图片的源代码_php资料_编程技术
PHP教程:实现网站的无限分类_[PHP教程]
XML入门教程-XML DHTML 行为_[XML教程]
C#减少图片文件大小和尺寸_[Asp.Net教程]
Visual C++ 6.0教程:c++程序的组成之标识符
如何让javascript,操作Cookie_php资料_编程技术
Reading number is top 10 pictures
NeedWallpaper13
BingBingFan apple dew point photo gallery3
这年头,找个靠谱的妹子太难了
Lewd,it is too lewd.
The real super beauty7
A beautiful girl to bud2
Sora aoi in China3
Absolutely shocked. National geographic 50 animal photographys10
The real super beauty12
Kim jong il's mistress, national beauty JinYuJi actor3
Download software ranking
Tram sex maniac 2 (H) rar bag12
Tram sex maniac 2 (H) rar bag11
Tram sex maniac 2 (H) rar bag19
Unix video tutorial19
c#程序设计案例教程
Tram sex maniac 2 (H) rar bag5
Boxer vs Yellow3
Call Of Duty5
Tram sex maniac 2 (H) rar bag7
金山office2007
qq published in(发表于) 2014/7/9 1:37:39 Edit(编辑)
asp.net2.0服务器控件之ImageButton控件

asp.net2.0服务器控件之ImageButton控件

asp.net2.0服务器控件之ImageButton控件

ImageButton控件

1.功能

使用ImageButton控件显示对单击鼠标作出响应的图像。它是实现与按钮功能相同的图像控件。

2.属性

ImageButton控件常用属性及描述如表1所示。



表1 ImageButton控件常用属性及描述

(1)ImageUrl属性。在属性获取或设置在ImageButton控件中显示的图像的位置。

语法:

object.ImageUrl[= string]

参数说明如下。

object:对象表达式。

string:用来指定ImageButton控件显示图像的URL。

* 说明:可以使用相对URL或绝对URL。相对URL使图像的位置与网页的位置相关联,而不指定服务器上的完整路径。该路径相对于网页的位置。由于不必更新代码,这使得将整个站点移动到服务器上的其他目录变得更加容易。绝对 URL 提供完整路径,因此将站点移到其他目录时需要更新代码。

(2)AlternateText属性。该属性指定在ImageUrl属性中指定的图像不可用时ImageButton控件中显示的文本。

语法:

object.AlternateText[= string]

参数说明如下。

object:对象表达式。

string:用来指定ImageButton控件指定的图像不可用时显示的文本。

3.方法

ImageButton控件常用方法同Label控件类似,请参见Label控件常用方法。

4.事件

ImageButton控件常用事件及描述如表2所示。



表2 ImageButton控件常用事件及描述

当用户单击ImageButton控件时将会触发该控件的 Click 事件。

* 示例

ImageButton控件Click事件的使用

本示例演示显示用户在图像中所单击位置的坐标。首先将ImageButton控件的ID属性设为ibtnTest,然后将ImageURL设为“~/165.gif”。程序代码如下:

protected void ibtnTest_Click(object sender, ImageClickEventArgs e)

{

string X = e.X.ToString();

string Y = e.Y.ToString();

this.Label1.Text = "X坐标:" + X + ",Y坐标:" + Y + "";

}

运行结果如图1所示。



图1 ImageButton控件的Click事件示例结果图

完整程序代码如下:

★ ★★★★ImageButtonTest.aspx代码文件完整程序代码★★★★★

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ImageButtonTest.aspx.cs" Inherits="ImageButtonTest" %>







ImageButtonTest









&nbsp;






























★ ★★★★ImageButtonTest.aspx.cs代码文件完整程序代码★★★★★

using System;

using System.Data;

using System.Configuration;

using System.Collections;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

public partial class ImageButtonTest : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

}

protected void ibtnTest_Click(object sender, ImageClickEventArgs e)

{

string X = e.X.ToString();

string Y = e.Y.ToString();

this.Label1.Text = "X坐标:" + X + ",Y坐标:" + Y + "";



添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.