状态栏出现大红十字

发布于 2024-11-29 01:22:28 字数 440 浏览 3 评论 0原文

我有一个包含状态栏(ToolStripStatusLabel)的程序,有一天在测试时,该程序抛出“索引超出范围”异常,并告诉我可以继续或退出。我单击“继续”,状态栏变成一个带有红十字的空白控件。

我认为这可能与这里的问题有关:MenuStrip上的“红十字”问题和 ToolStrip

但我不明白答案,也不知道其原因是什么,因为除了将文本分配给某些错误消息或通知之外,我实际上没有对状态条执行任何操作用户什么该计划正在进行中。

非常感谢任何信息。这种事只发生过一次,但如果我不知道为什么会这样的话,接下来的一段时间我会很困扰。

我正在使用 .NET 3.5 SP1 C#

I have a program that contains a statusbar (ToolStripStatusLabel) which while testing one day, the program threw the "index out of range" exception and told me I could either continue or quit. I clicked continue and the status bar turned into a blank control with a red cross through it.

I think it may be related to this question here: "Red Cross" problem on MenuStrip and ToolStrip

But I don't understand the answer, nor do I really know what the cause of it was, as I really do not do anything to the status strip besides assigning the text to some error message or notice to tell the user what is going on with the program.

Any information is greatly appreciated. It happened only once but it's gonna bother me for the next while if I don't know why it did that.

I'm using .NET 3.5 SP1 C#

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

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

发布评论

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

评论(1

情释 2024-12-06 01:22:28

您的问题是,您未处理的 IndexOutOfRangeException 导致 ToolStrip 中出现损坏状态。所以它无法正确绘制自己。

为了安全起见,不要遗憾地检查您的代码,该代码从 StatusStripToolStripStatusLabel 设置了可能引发 IndexOutOfRangeException 的内容。

Your problem is that you cause with your unhandled IndexOutOfRangeException a corrupt state in the ToolStrip. So it can't properly draw itself.

To be safe not sorry check your code that sets something from the StatusStrip or ToolStripStatusLabel that can throw an IndexOutOfRangeException.

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