title: c# checked listbox MouseMove vs MouseHover event handler
body: <p>I am using the following <code>MouseMove</code> event-handler to show the text-file content as a tooltip on CheckedListBox and there is a text-file object tagged to each checkedListBoxItem.</p>
  
  <pre><code>private void checkedListBox1_MouseMove(object sender, MouseEventArgs e)
          {
              int itemIndex = checkedListBox1.IndexFromPoint(new Point(e.X, e.Y));
  
              if (itemIndex &gt;= 0)
              {
                  if (checkedListBox1.Items[itemIndex] != null)
                  {
                      TextFile tf = (TextFile)checkedListBox1.Items[itemIndex];
  
                      string subString = tf.JavaCode.Substring(0, 350);
  
                      toolTip1.ToolTipTitle = tf.FileInfo.FullName;
                      toolTip1.SetToolTip(checkedListBox1, subString + "\n... ... ...");
                  }
              }
          }
  </code></pre>
  
  <p>The problem is, my application is slowing down because of frequent mouse movements on the checkedListBox.</p>
  
  <p>As an alternative, I thought, I should use <code>MouseHover</code> event and its handler. But I could not find out which checkedListBoxItem my musePointer is currently on. Like this:</p>
  
  <pre><code>private void checkedListBox1_MouseHover(object sender, EventArgs e)
          {
              if (sender != null)
              {
                  CheckedListBox chk = (CheckedListBox)sender;
  
                  int index = chk.SelectedIndex;
  
                  if (chk != null)
                  {
                      TextFile tf = (TextFile)chk.SelectedItem;
  
                      string subString = tf.FileText.Substring(0, 350);
  
                      toolTip1.ToolTipTitle = tf.FileInfo.FullName;
                      toolTip1.SetToolTip(checkedListBox1, subString + "\n... ... ...");
                  }
              }
          }
  </code></pre>
  
  <p>Here <code>int index</code> is returning -1 and <code>chk.SelectedItem</code> is returning <code>null</code>.</p>
  
  <p>What can be the solution of this type of problem?</p>