void RenameItem()
{
// Display a edit control that will do the editing of the item
// Get the item index first
int index;
HitTest(lastClickedPoint, out index, false);
using ( Graphics g = Graphics.FromHwnd(Handle) )
{
Rectangle itemRect = GetLabelRect(index);
// Empty the text box first
textBox.Text = "";
// Move it to the top of the item rectangle
if ( bands[currentBandIndex].IconView == IconView.Large )
itemRect.Inflate(5, 0);
else
itemRect = new Rectangle(itemRect.Left, itemRect.Top, itemRect.Right, itemRect.Height + 5);
textBox.Bounds = itemRect;
// initialize the text box to the item text
textBox.Text = bands[currentBandIndex].Items[index].Text;
// Flag that we are editing an item and not a header
// --We'll use this on the textbox event handlers
editingAnItem = true;
textBox.Visible = true;
textBox.Focus();
}
}