流程布局面板/链接标签的问题

发布于 2024-10-12 23:19:51 字数 89 浏览 11 评论 0原文

我正在将文本设置为链接标签并将这些标签添加到流程布局面板。它似乎砍掉了链接标签的末端,因此我的标签只有 3/4 的文本。有谁知道为什么会这样?

谢谢

i am setting text to a link label and adding these labels to a flow layout panel. It seems to be chopping off the ends of the link labels and as such i have labels with only 3/4's of the text. Does anyone know why this might be?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

风铃鹿 2024-10-19 23:19:51

我不确定您是否通过代码将 LinkLabels 添加到 FlowLayoutPanel,但您可以设置一个属性以使它们正常工作。

    var link = new LinkLabel();
    link.Text = "Some really long string";
    link.AutoSize = true;   //This is really important!

    FlowLayoutPanel1.Controls.Add(link);

如果您没有设置每个 LinkLabels AutoSize 属性,它们只会截掉超出其默认边界的所有文本。

编辑:
我的 Testapp 包括在表单上放置一个 FlowLayoutPanel 和一个要单击的按钮,并在 OnClick 处理程序中使用上述代码。表格上没有其他任何更改。

如果没有将 AutoSize 属性设置为 true,我遇到了与您描述的相同的问题。将其设置为 True 至少可以解决我的问题:)

I'm not sure if you are adding the LinkLabels to the FlowLayoutPanel through code, but there is a property you can set to make them work properly.

    var link = new LinkLabel();
    link.Text = "Some really long string";
    link.AutoSize = true;   //This is really important!

    FlowLayoutPanel1.Controls.Add(link);

If you don't set each LinkLabels AutoSize property, they just chop off any text that goes further than their default bounds.

Edit:
My Testapp consists of placing a FlowLayoutPanel on the form, and a button to click, with the above code in the OnClick handler. Nothing else was changed on the form.

Without the AutoSize property set to true, I had the same problem you described. Setting it to True fixes it for me at least :)

街道布景 2024-10-19 23:19:51

我通过将 FlowLayoutPanel 放在空白表单上并放入许多 LinkLabels 来对此进行了测试。 FlowLayoutPanel 的宽度很窄,我尝试将 Text 属性添加到链接标签来破坏布局。

即使在链接标签中放置不带空格的文本也不会导致您描述的问题 - 文本只是换行到下一行。

您是否在链接标签上设置了任何属性?这是我解决此问题的唯一方法。

我将其中一个链接标签的大小更改为小于文本的固定大小,这几乎完全符合您报告的内容。我建议链接标签的宽度属性小于您显示的文本。

I have tested this by dropping a FlowLayoutPanel on a blank form and dropping in many LinkLabels. The width of the FlowLayoutPanel is narrow and I have tried adding Text properties to the link labels to break the layout.

Even putting text with no spaces in the link label doesn't cause the issue you describe - the text simply wraps around onto the next line.

Do you have any properties set on the link labels? This is the only way I could get this issue to occur.

I changed the size of one of the link labels to a fixed size smaller than the text and this pretty much did exactly what you report. I would suggest that the Width property of your link label is smaller than the text you are displaying.

筑梦 2024-10-19 23:19:51

你能检查一下链接标签的 LinkArea 属性吗?默认值约为 25。
我认为您必须将其设置为用于显示为链接标签文本的最大值。

Can you check the LinkArea property of the link label .. the default is about 25.
I think you will have to set it to the maximum value you are using to display as text for the link label.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文