动态标签 [英] Dynamic Labels
本文介绍了动态标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在通过拖放创建动态标签.我的问题是如何知道生成的标签的名称,以便可以通过发送Unicode来操纵它们?
这是我的代码:
I am creating dynamic labels by dragging and dropping. My question is how would I know the name of the generated labels so that I can manipulate them by sending Unicodes?
Here is my code:
private void ImageBox_DragDrop(object sender, DragEventArgs e)
{
Graphics g = ImageBox.CreateGraphics();
g.DrawImage((Image)e.Data.GetData(DataFormats.Bitmap),
new Point(e.X - this.Left, e.Y - this.Top - 150));
Point p2 = PointToClient(Cursor.Position);
Label buttlbl_0 = new Label();
buttlbl_0.Location = new Point(p2.X, p2.Y);
buttlbl_0.Size = new System.Drawing.Size(37, 37);
buttlbl_0.BackColor = System.Drawing.Color.DarkGray;
this.Controls.Add(buttlbl_0);
buttlbl_0.BringToFront();
ImageBox.Invalidate();
}
}
推荐答案
您可以-嗯-设置Name
属性...
此时,您可以在将它们添加到Controls
列表中之后进行查找.
You could - ummm - set theName
property...
At that point, you can look for them after they''re added to theControls
list.
这篇关于动态标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文