我在Visual Studio 2010中(从2008年转换)项目后,我已经创建了一个用户控制,就像这样:Visual Studio的挡在设计模式下扩展用户控制
namespace Common.Controls
{
public partial class Panel_BaseMap : UserControl
{
public Panel_BaseMap()
{
//Some properties initialization here, just like = new X();
InitializeComponent();
}
private void BaseMapPanel_Load(object sender, EventArgs e) {
//Here, a new Thread is initialized and started.
}
}
}
我不有任何问题,它在设计模式下打开没有任何问题。但是,我已经创建了延伸到第一个,这样一个新的用户控件:
using Common.Controls;
namespace BC.controls
{
public partial class MapPanel : Panel_BaseMap
{
public MapPanel()
{
InitializeComponent();
}
}
}
那么,在非常时刻,我尝试打开设计模式,这种新的控制,Visual Studio中被完全堵塞,我有强制它关闭,因为它没有响应。我尝试了很多东西,例如:
public MapPanel()
{
if (!this.DesignMode)
InitializeComponent();
}
仍然阻塞。我已经打开了Visual Studio的第二个实例,然后在第一个“调试 - >附加到进程 - > devenv”,并且我在第二个实例上的Load方法和两个构造函数上都放置了一个断点。结果是:两个实例完全阻塞。
任何人都可以帮助我吗?
非常感谢您提前!
使用DesignMode属性可防止代码在设计模式下执行。例如,你绝对不想启动该线程。 – 2011-12-15 10:56:33