Add Tooltips for Label : Tooltips « GUI Windows Form « C# / C Sharp

Home
C# / C Sharp
1.2D Graphics
2.Class Interface
3.Collections Data Structure
4.Components
5.Data Types
6.Database ADO.net
7.Design Patterns
8.Development Class
9.Event
10.File Stream
11.Generics
12.GUI Windows Form
13.Language Basics
14.LINQ
15.Network
16.Office
17.Reflection
18.Regular Expressions
19.Security
20.Services Event
21.Thread
22.Web Services
23.Windows
24.Windows Presentation Foundation
25.XML
26.XML LINQ
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source
C# / C Sharp » GUI Windows Form » TooltipsScreenshots 
Add Tooltips for Label
Add Tooltips for Label


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

public class Form1 : Form
{
   private System.Windows.Forms.Label firstLabel;
   private System.Windows.Forms.Label secondLabel;
   private System.Windows.Forms.ToolTip labelsToolTip;

   public Form1() {
       InitializeComponent();
   }

   private void InitializeComponent()
   {
      this.firstLabel = new System.Windows.Forms.Label();
      this.secondLabel = new System.Windows.Forms.Label();
      this.labelsToolTip = new System.Windows.Forms.ToolTip(new System.ComponentModel.Container());
      this.SuspendLayout();
      // 
      // firstLabel
      // 
      this.firstLabel.AutoSize = true;
      this.firstLabel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
      this.firstLabel.Font = new System.Drawing.Font("Microsoft Sans Serif"10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
      this.firstLabel.Location = new System.Drawing.Point(1220);
      this.firstLabel.Name = "firstLabel";
      this.firstLabel.Size = new System.Drawing.Size(9218);
      this.firstLabel.TabIndex = 0;
      this.firstLabel.Text = "This is a label.";
      this.labelsToolTip.SetToolTip(this.firstLabel, "First Label");
      // 
      // secondLabel
      // 
      this.secondLabel.AutoSize = true;
      this.secondLabel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
      this.secondLabel.Font = new System.Drawing.Font("Microsoft Sans Serif"10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
      this.secondLabel.Location = new System.Drawing.Point(1269);
      this.secondLabel.Name = "secondLabel";
      this.secondLabel.Size = new System.Drawing.Size(13318);
      this.secondLabel.TabIndex = 1;
      this.secondLabel.Tag = "";
      this.secondLabel.Text = "This is another Label.";
      this.labelsToolTip.SetToolTip(this.secondLabel, "Second Label");
      // 
      // ToolTipExampleForm
      // 
      this.AutoScaleDimensions = new System.Drawing.SizeF(6F13F);
      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
      this.ClientSize = new System.Drawing.Size(252124);
      this.Controls.Add(this.secondLabel);
      this.Controls.Add(this.firstLabel);
      this.Name = "ToolTipExampleForm";
      this.Text = "ToolTip Demonstration";
      this.ResumeLayout(false);
      this.PerformLayout();

   }

  [STAThread]
  static void Main()
  {
    Application.EnableVisualStyles();
    Application.Run(new Form1());
  }

}


           
       
Related examples in the same category
1.Add Tooltip to a componentAdd Tooltip to a component
2.Add icon to TooltipAdd icon to Tooltip
3.Tooltips DemoTooltips Demo
4.Tooltips for ButtonTooltips for Button
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.