|
-
February 19th, 2009, 12:37 PM
#1
Make copy of label
Hi
I have 3 designed labels on forms with different colors and shapes.
I would like to know if in a file .cs make several copies of 3 pre designed labels on Forms. My purpose is to define and make visible only the necessary labels.
Example:
pseudo - code
pre designed label, label 2 and label 3
make n copies of these 3 labels
change location of each created labels
end of pseudo - code
Thanks
-
February 19th, 2009, 12:43 PM
#2
Re: Make copy of label
Here's an example how to create N labels on runtime:
Code:
const int N = 5;
Label[] labelA = new Label[N];
...
for(int i=0;i<N;i++)
{
labelA[i] = new Label();
labelA[i].Name = "LabelA" + i;
labelA[i].Size = label1.Size;
labelA[i].Location = new Location(WHATEVER...);
labelA[i].Color = label1.Color;
...
etc.
this.Controls.Add(labelA[i]);
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|