遍历Controls上的控件就行了,这有一个遍历PictureBox的例子,你改成文本控件就行了,
foreach (System.Windows.Forms.Control control in this.Controls)//遍历Form上的所有控件
{
if (control is System.Windows.Forms.PictureBox)
{
System.Windows.Forms.PictureBox pb = (System.Windows.Forms.PictureBox)control;
pb.AllowDrop = true;
}
}
温馨提示:答案为网友推荐,仅供参考