停止 ReSharper 或 Visual Studio 重新格式化我的代码
Stop ReSharper or Visual Studio from reformatting my code
我目前正在开发一个 Windows 表单应用程序,并在 MyForm.Designed.cs
的 InitializeComponent()
方法中设置标签的文本。我将其设置为函数调用,因此它看起来像第一行,但它不断被重新格式化为第二行。第一行完美运行,只是它正在重新格式化。
this.teamGroup.Text = LocalizedLanguage.GetValue("SelectedTeamLabel");
this.teamGroup.Text = "Selected Team";
此外,TabIndex 也会发生这种情况。
我有:
- C# 6.0
- Visual Studio 2015 社区
- ReSharper 10.0.2
您可以在工具菜单的选项下关闭 VS 中的自动代码格式化,选择 文本编辑器 -> -> 格式化 -> 常规 页面,然后取消选中那里的所有框.关闭所有自动格式化设置后,您仍然可以手动格式化。
你可以在这里查看类似的东西link1 or link2
Jacob,你不应该手动修改 InitializeComponent 中的代码。
/// <summary>
/// Required method for Designer support - do not modify
/// contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
如果您想为组件添加一些东西,请使用以下方法:
public YourForm ()
{
InitializeComponent();
CustomInitializeComponent();
}
private void CustomInitializeComponent()
{
teamGroup.Text = LocalizedLanguage.GetValue("SelectedTeamLabel");
}
我目前正在开发一个 Windows 表单应用程序,并在 MyForm.Designed.cs
的 InitializeComponent()
方法中设置标签的文本。我将其设置为函数调用,因此它看起来像第一行,但它不断被重新格式化为第二行。第一行完美运行,只是它正在重新格式化。
this.teamGroup.Text = LocalizedLanguage.GetValue("SelectedTeamLabel");
this.teamGroup.Text = "Selected Team";
此外,TabIndex 也会发生这种情况。
我有:
- C# 6.0
- Visual Studio 2015 社区
- ReSharper 10.0.2
您可以在工具菜单的选项下关闭 VS 中的自动代码格式化,选择 文本编辑器 -> -> 格式化 -> 常规 页面,然后取消选中那里的所有框.关闭所有自动格式化设置后,您仍然可以手动格式化。
你可以在这里查看类似的东西link1 or link2
Jacob,你不应该手动修改 InitializeComponent 中的代码。
/// <summary>
/// Required method for Designer support - do not modify
/// contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
如果您想为组件添加一些东西,请使用以下方法:
public YourForm ()
{
InitializeComponent();
CustomInitializeComponent();
}
private void CustomInitializeComponent()
{
teamGroup.Text = LocalizedLanguage.GetValue("SelectedTeamLabel");
}