What container to dynamically display a bunch of labels?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a bunch of labels, and want to put in some container, which should be:

1. The number of labels for each column is fixed, say 16/row. And the number
of currently displaying rows is fixed, say 10.
2. The number of total rows is unknown before hand. So if it is larger than
10, the vertical scroll bar should be shown up and let the user view other
part of the rows.
3. In my program, I would add those labels one by one, from left to right,
from up to bottom.

What container should I use?

Thanks,
 
Gary said:
I have a bunch of labels, and want to put in some container, which should be:

1. The number of labels for each column is fixed, say 16/row. And the number
of currently displaying rows is fixed, say 10.
2. The number of total rows is unknown before hand. So if it is larger than
10, the vertical scroll bar should be shown up and let the user view other
part of the rows.
3. In my program, I would add those labels one by one, from left to right,
from up to bottom.

What container should I use?

Thanks,

Is there a reason why you wouldn't just use a ListView, rather than
Labels?
 
Hello Gary,

In order to achieve the described, I belive it woould be best to write a
user control inheriting the System.Windows.Forms.Panel class. You could
override the OnLayout method and arrange the Label controls when necessary.
For instance, have a counter which counts the number of controls processed
and manipulates the X and Y values accordingly.

You can do the content scrolling by assigning True to the (custom) container
control's AutoScroll property. You could also set an appropriate
AutoScrollMargin, if necessary.

I hope this helps.
 
No. I am new to this field so that still wondering which way is the best.

My goal is to extract all available characters from a certain font, then
display each character in this table like control. If user changed the font,
every character should be changed as well. And I need to trap the events such
as mouse over a character so that I can display the tip and do something when
user clicked on that character.

Any suggestion?

Thanks,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top