链接标签C# - 显示它们的列表 [英] Link Labels c# - displaying a list of them

查看:101
本文介绍了链接标签C# - 显示它们的列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想挂标贴的列表添加到列表视图。我AMD这样做这样

I am trying to add a list of linked lables to a listview. I amd doing so like this

        foreach (String s in values)
        {
            LinkLabel label = new LinkLabel();
            label.Text = s;
            txtBox.Controls.Add(label);
        }
    }



它保持只需添加一个项目到列表框中即使寿有更多。任何想法?

It keeps adding just one item to the listbox even tho there are more. Any ideas?

PS),我可以告诉有来自添加breakbpoint和迭代

ps) i can tell there are more items from adding a breakbpoint and using console.writeline when iterating

感谢

推荐答案

无论是的ListView 的ListBox 控件真正旨在承载子控件。

Neither the ListView or ListBox controls are really designed to host child controls.

如果这就是你所需要的,那么你应该使用一个容器控件,如作为 面板 。我建议使用一个 的TableLayoutPanel FlowLayoutPanel的 ,能够自动管理其子控件的布局。

If that's what you need, then you should be using a container control, such as a Panel. I recommend using either a TableLayoutPanel or a FlowLayoutPanel that can automatically manage the layout of its child controls.

这篇关于链接标签C# - 显示它们的列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆