简体   繁体   中英

interesting error: new form has black line across it, how do I get rid of it

I was creating a new form and my IDE crashed, or it was having problems, and now every time I create a new form it has a black line across it. The black line is not something I was adding, it appears to be the black line from the top of the form getting painted in the wrong place. The interesting thing is that every time I reload the form the line moves up until after the 5th load it disappears. How do I stop this happening? I have tried build, rebuild, clean solution (restart visual studio) but it is still there, it isn't consistent either which also annoying, any ideas?

通过它的黑色线条的形式的屏幕截图

The way the line appears overtop of the window (it goes over the border) makes it look like it's probably outside of the Designer-generated code.

Some exploratory coding:

  1. Make a backup!
  2. Try commenting out as much code-behind as possible. Test if it recurs with only the designer-generated code.
    • if it doesn't, then slowly uncomment your code-behind. The highest-risk code is anything that either directly manipulates the Graphics system.
    • if it does, then try commenting out different control declarations until it goes away (you'll be tweaking generated code, so this is where a good backup is critical)

To help test, can you comment out any code-behind so that it's only the Designer-generated code and see if it still occurs?

如果每次进入设计模式时线条向上移动它应该在如上所述的Designer生成的代码后面的代码中,如果没有尝试查看Form_Initialize,如果没有检查是否使用用户控件(即不是vs标准之一,也许你自己写的一个)并在那里做同样的检查(甚至可以在用户控件的构造函数中)。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM