using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace ToolTipTest
{
public partial class Form1 : Form
{
private Label[] labelArray = new Label[100];
public Form1()
{
InitializeComponent();
for(int i = 0; i < labelArray.Length; i++)
{
labelArray[ i] = new Label();
flowLayoutPanel1.Controls.Add(labelArray[ i]);
labelArray[ i].AutoSize = true;
labelArray[ i].Text = "Label" + i.ToString();
}
}
private void timer1_Tick(object sender, EventArgs e)
{
for(int i = 0; i < labelArray.Length; i++)
{
toolTip1.SetToolTip(labelArray[ i], i.ToString());
}
}
}
}
namespace ToolTipTest
{
partial class Form1
{
/// <summary>
/// 必要なデザイナ変数です。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 使用中のリソースをすべてクリーンアップします。
/// </summary>
/// <param name="disposing">マネージ リソースが破棄される場合 true、破棄されない場合は false です。</param>
protected override void Dispose(bool disposing)
{
if(disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows フォーム デザイナで生成されたコード
/// <summary>
/// デザイナ サポートに必要なメソッドです。このメソッドの内容を
/// コード エディタで変更しないでください。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.SuspendLayout();
//
// toolTip1
//
this.toolTip1.ShowAlways = true;
//
// timer1
//
this.timer1.Enabled = true;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// flowLayoutPanel1
//
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(292, 266);
this.flowLayoutPanel1.TabIndex = 0;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(292, 266);
this.Controls.Add(this.flowLayoutPanel1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.ToolTip toolTip1;
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
}
}