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

Reading number is top 10 articles
C#网络应用编程基础练习题与答案(五)_[Asp.Net教程]
Visual,Studio,2008,Service,Pack,1,-,BETA,发布_[Asp.Net教程]
PHP5.2.0中allow_url_include的应用和解释_php资料_编程技术
SQL,Artisan多层查询条件嵌套功能_[SQL,Server教程]
PHP上传文件的代码_[PHP教程]
Excel,数据导入到,Access、Sql,Server,中示例代码_[SQL,Server教程]
Php高手带路--问题汇总解答_[PHP教程]
ASP.NET应用技巧:关于HtmlForm控件_[Asp.Net教程]
php实现下载功能_php资料_编程技术
利用XMLHTTP从其他页面获取网页数据_JavaScript技术_编程技术
Reading number is top 10 pictures
The money of more than 100 countries and regions19
The world's top ten most beautiful railway station1
八个盛产美女的国家1
Shandong jinan is about to dismantle a one hundred-year history of the building
More attractive than sora aoi4
修电脑也有这么漂亮的美女
The terra-cotta warriors3
黑社会大哥相亲
张家界的玻璃桥
Is said to be a Chinese female artist fame explicit pictures before1
Download software ranking
WebService在.NET中的实战应用教学视频 → 第3集
Tram sex maniac 2 (H) rar bag8
Boxer Classic video1
Sora aoi's film--cangkong_Blue.Sky
Jinling thirteen stock
SP4 for SQL2000
WebService在.NET中的实战应用教学视频 → 第2集
打鸟视频
VeryCD电驴(EasyMule) V1.1.9 Build09081
Detective task-the top secret prostitution files
qq published in(发表于) 2014/7/11 9:18:16 Edit(编辑)
C#中ToolTip控件应用实例

C#中ToolTip控件应用实例

C#中ToolTip控件应用实例

ToolTip控件

功能

该控件是一个长方形的弹出窗口,在用户将指针悬停在一个控件上时,该窗口显示有关该控件用途的简短说明。图1所示为ToolTip控件。



图1 ToolTip控件

2.属性

ToolTip控件常用属性及说明如表1所示。



表1 ToolTip控件常用属性及说明

下面详细介绍UseAnimation属性,此属性获取或设置一个值,该值确定在显示工具提示时,是否应使用动画效果。

语法:

本教程来自http://www.isstudy.com/
属性值:如果窗口使用动画效果,为True;否则为False。默认值为True。

3.方法

ToolTip控件常用方法及说明如表2所示。



表2 ToolTip控件常用方法及说明

下面详细介绍SetToolTip方法,此方法使工具提示文本与指定的控件相关联。

语法:

public void SetToolTip (Control control,string caption)
参数说明如下。

control:将工具提示文本与其关联的Control。

caption:指针位于控件上方时要显示的工具提示文本。

示例 网站源代码

SetToolTip方法的使用

本示例通过调用SetToolTip方法,设置一个【ToolTip】按钮相关联,示例运行结果如图2所示。



图2 SetToolTip方法的使用

程序主要代码如下:

toolTip1.SetToolTip(button1, "Button按钮");

完整程序代码如下:网站源代码

★★★★★主程序文件完整程序代码★★★★★

using System;

using System.Collections.Generic;

using System.Windows.Forms;

namespace _8_15

{

static class Program

{

///



/// 应用程序的主入口点。

///


[STAThread]

static void Main()

{

Application.EnableVisualStyles();

Application.SetCompatibleTextRenderingDefault(false);

Application.Run(new frmToolTip());

}

}

}

★★★★★frmToolTip窗体设计文件完整程序代码★★★★★

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;

namespace _8_15

{

public partial class frmToolTip : Form

{

public frmToolTip()

{

InitializeComponent();

}

private void frmToolTip_Load(object sender, EventArgs e)

{

toolTip1.SetToolTip(button2, "Button按钮");

toolTip1.UseAnimation = true;

toolTip1.Active = true;

}

private void toolTip1_Popup(object sender, PopupEventArgs e)

{

}

private void button2_Click(object sender, EventArgs e)

{

}

}

}

★★★★★frmToolTip窗体代码文件完整程序代码★★★★★

namespace _8_15

{

partial class frmToolTip

{

///

/// 必需的设计器变量。

///


private System.ComponentModel.IContainer components = null;

///

/// 清理所有正在使用的资源。

///


/// 如果应释放托管资源,为 true;否则为 false。

protected override void Dispose(bool disposing)

{

if (disposing && (components != null))

{

components.Dispose();

}

base.Dispose(disposing);

}

#region Windows 窗体设计器生成的代码

///

/// 设计器支持所需的方法 - 不要

/// 使用代码编辑器修改此方法的内容。

///


private void InitializeComponent()

{

this.components = new System.ComponentModel.Container();

this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);

this.button1 = new System.Windows.Forms.Button();

this.button2 = new System.Windows.Forms.Button();

this.SuspendLayout();

//

// toolTip1

//

this.toolTip1.AutoPopDelay = 5000;

this.toolTip1.InitialDelay = 200;

this.toolTip1.ReshowDelay = 100;

this.toolTip1.ShowAlways = true;

this.toolTip1.Popup += new System.Windows.Forms.PopupEventHandler(this.toolTip1_Popup);

//

// button1

//

this.button1.Location = new System.Drawing.Point(71, 73);

this.button1.Name = "button1";

this.button1.Size = new System.Drawing.Size(75, 23);

this.button1.TabIndex = 0;

this.button1.Text = "ToolTip";

this.button1.UseVisualStyleBackColor = true;

//

// button2

//

this.button2.Location = new System.Drawing.Point(93, 50);

this.button2.Name = "button2";

this.button2.Size = new System.Drawing.Size(75, 23);

this.button2.TabIndex = 0;

this.button2.Text = "ToolTip";

this.button2.UseVisualStyleBackColor = true;

this.button2.Click += new System.EventHandler(this.button2_Click);

//

// frmToolTip

//

this.ClientSize = new System.Drawing.Size(292, 142);

this.Controls.Add(this.button2);

this.Name = "frmToolTip";

this.Load += new System.EventHandler(this.frmToolTip_Load);

this.ResumeLayout(false);

}

#endregion

private System.Windows.Forms.ToolTip toolTip1;

private System.Windows.Forms.Button button1;

private System.Windows.Forms.Button button2;

}

}



添加到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.