是的,似乎无法在SO上找到这个,我肯定以前肯定已经被问到了,无论如何....
简单地说,我正在从头开始创建一个新的自定义控件,我有一个方法:
private void Foo()
我直接从构造函数调用。我在Foo()中放了一个断点,但是调试器在这个断点处永远不会停止,它只显示了测试容器:
任何人都知道如何使调试器在断点处停止而不直接进入“测试容器”对话框。
代码
在控件后面:
namespace AreaPickerDotNet
{
public partial class AreaPickerDotNet : UserControl
{
Assembly _assem;
public AreaPickerDotNet()
{
InitializeComponent();
_assem = Assembly.GetExecutingAssembly();
Foo();
}
private void Foo()
{
try
{
StreamReader _textStreamReader = new StreamReader(_assem.GetManifestResourceStream("foo.txt"));
MessageBox.Show(_textStreamReader.GetHashCode().ToString());
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
throw;
}
}
}
}
设计师代码:
namespace AreaPickerDotNet
{
partial class AreaPickerDotNet
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.SuspendLayout();
//
// AreaPickerDotNet
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Name = "AreaPickerDotNet";
this.Size = new System.Drawing.Size(291, 259);
this.ResumeLayout(false);
}
#endregion
}
}
答案 0 :(得分:2)
您似乎已经开发了UI控件,但没有将其添加到主窗体。
您是否真的从应用程序中的任何位置调用AreaPickerDotNet()
方法?我认为您需要通过设计人员或代码直接将UI控件添加到表单中。
<强>更新强> 在您发表评论后,我停下来了解您的问题。