ListBox坐标
private void CreateEditBox(object sender)
{
listBox1= (ListBox)sender ;
itemSelected = listBox1.SelectedIndex ;
Rectangle r = listBox1.GetItemRectangle(itemSelected);
string itemText = (string)listBox1.Items[itemSelected];
editBox.Location = new System.Drawing.Point(r.X + delta , r.Y + delta ) ;
editBox.Size = new System.Drawing.Size(r.Width -10 , r.Height- delta);
editBox.Show();
listBox1.Controls.AddRange(new System.Windows.Forms.Control[] {this.editBox});
editBox.Text = itemText ;
editBox.Focus();
editBox.SelectAll();
editBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.EditOver);
editBox.LostFocus += new System.EventHandler(this.FocusOver);
}使用 GetItemRectangle 和 Rectangle
MSDN2:http://msdn2.microsoft.com/zh-cn/library/system.drawing.rectangle.location.aspx


listBox1.Controls.AddRange(
浙公网安备 33010602011771号