ICreate.Controls.Bars Send comments on this topic.
Cold Event
See Also  Example
ICreate.Controls.Bars Namespace > BarItem Class : Cold Event






Occurs when the mouse cursor moves off the BarItem.

Syntax

Visual Basic (Declaration) 
Public Event Cold() As EventHandler
Visual Basic (Usage)Copy Code
Dim instance As BarItem
Dim handler As EventHandler
 
AddHandler instance.Cold, handler
C# 
public event EventHandler Cold()
Delphi 
public event Cold: EventHandler; 
JScript 
In JScript, you can handle the events defined by another class, but you cannot define your own.
Managed Extensions for C++ 
public: __event EventHandler* Cold();
C++/CLI 
public:
event EventHandler^ Cold();

Example

This example uses two TaskBar controls. The one lists all commands, the other commands the user wishes to access. This could be used to customise an application. The Hot and Cold BarItem events are used to display a tip related to the hot item. The tip text is stored as the Tag on the BarItem. Clicking on an item in the commands TaskBar moves it to the selected commands TaskBar. Similarly clicking on an item in the selected commands TaskBar moves it to the commands TaskBar.

Note that instead of attaching to the Cold event of each BarItem you can use the ItemCold event of the TaskBar.

The image below shows the Form for this example.

Visual BasicCopy Code
Imports ICreate.Controls.Bars

Public Class HotColdEventExample

    Public Sub New()

        InitializeComponent()

        TaskBarItemNewDocument.Tag = "Create a new Word document."
        TaskBarItemNewImage.Tag = "Create a new Windows bitmap."
        TaskBarItemNewMusicFile.Tag = "Create a new MP3 file."
        TaskBarItemNewVideo.Tag = "Create a new QuickTime video."
        TaskBarItemNewSpreadsheet.Tag = "Create a new Lotus 123 spreadsheet."
        TaskBarItemNewDatabase.Tag = "Creae a new Microsoft Access database."
        TaskBarItemNewCalendar.Tag = "Create a new shared calendar."
        TaskBarItemNewContact.Tag = "Create a new Windows address book contact."
        TaskBarItemNewSMS.Tag = "Create a new Short Message Service message."
        TaskBarItemNewFax.Tag = "Create a new Fax."

    End Sub

    Private Sub OnItemCold(ByVal sender As System.Object, ByVal e As System.EventArgs) _
        Handles TaskBarItemNewVideo.Cold, _
        TaskBarItemNewSpreadsheet.Cold, _
        TaskBarItemNewSMS.Cold, _
        TaskBarItemNewMusicFile.Cold, _
        TaskBarItemNewImage.Cold, _
        TaskBarItemNewFax.Cold, _
        TaskBarItemNewDocument.Cold, _
        TaskBarItemNewDatabase.Cold, _
        TaskBarItemNewContact.Cold, _
        TaskBarItemNewCalendar.Cold

        LabelHelp.Text = ""

    End Sub

    Private Sub OnItemHot(ByVal sender As System.Object, ByVal e As System.EventArgs) _
        Handles TaskBarItemNewVideo.Hot, _
        TaskBarItemNewSpreadsheet.Hot, _
        TaskBarItemNewSMS.Hot, _
        TaskBarItemNewMusicFile.Hot, _
        TaskBarItemNewImage.Hot, _
        TaskBarItemNewFax.Hot, _
        TaskBarItemNewDocument.Hot, _
        TaskBarItemNewDatabase.Hot, _
        TaskBarItemNewContact.Hot, _
        TaskBarItemNewCalendar.Hot

        Dim item As TaskBarItem = sender
        LabelHelp.Text = item.ToString()

    End Sub

    Private Sub taskBarCommands_ItemSelected(ByVal sender As System.Object, ByVal args As TaskBarItemEventArgs) _
        Handles TaskBarCommands.ItemSelected

        args.Item.Parent = TaskBarSelectedCommands

    End Sub

    Private Sub taskBarSelectedCommands_ItemSelected(ByVal sender As System.Object, ByVal args As TaskBarItemEventArgs) _
        Handles TaskBarSelectedCommands.ItemSelected

        args.Item.Parent = TaskBarCommands

    End Sub
End Class
C#Copy Code
using System; 
using System.Windows.Forms; 
using ICreate.Controls.Bars; 
 
namespace ExamplesBarItemCSharp 

    public partial class HotColdEventExample : Form 
    { 
        public HotColdEventExample() 
        { 
            InitializeComponent(); 
 
            taskBarItemNewDocument.Tag = "Create a new Word document."; 
            taskBarItemNewImage.Tag = "Create a new Windows bitmap."; 
            taskBarItemNewMusicFile.Tag = "Create a new MP3 file."; 
            taskBarItemNewVideo.Tag = "Create a new QuickTime video."; 
            taskBarItemNewSpreadsheet.Tag = "Create a new Lotus 123 spreadsheet."; 
            taskBarItemNewDatabase.Tag = "Creae a new Microsoft Access database."; 
            taskBarItemNewCalendar.Tag = "Create a new shared calendar."; 
            taskBarItemNewContact.Tag = "Create a new Windows address book contact."; 
            taskBarItemNewSMS.Tag = "Create a new Short Message Service message."; 
            taskBarItemNewFax.Tag = "Create a new Fax."; 
        } 
 
        private void OnItemHot(object sender, EventArgs e) 
        { 
            TaskBarItem item = (TaskBarItem)sender; 
            labelHelp.Text = item.Tag.ToString();  
        } 
 
        private void OnItemCold(object sender, EventArgs e) 
        { 
            labelHelp.Text = "";             
        } 
 
        private void taskBarCommands_ItemSelected(object sender, TaskBarItemEventArgs args) 
        { 
            args.Item.Parent = taskBarSelectedCommands; 
        } 
 
        private void taskBarSelectedCommands_ItemSelected(object sender, TaskBarItemEventArgs args) 
        { 
            args.Item.Parent = taskBarCommands; 
        } 
    } 
}

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also