在设置设计器中将字符串属性设置为 \n

发布于 2024-11-05 20:57:27 字数 271 浏览 5 评论 0原文

在Visual Studio设置设计器中,如何将字符串类型的设置设置为换行符?输入 \n 会导致字符串被设置为字面意思 \n - 转义序列在设置编辑器中似乎没有意义。那么如何将设置的值设置为不可打印字符呢?

设置设计器编辑 App.config (xml) 文件和 Settings.settings 文件。我考虑过直接编辑 App.config 文件,但在那里输入 \n 再次将字符串设置为字面上的 \n

In the visual studio settings designer, how can a setting with string type be set to the newline character? Entering \n results in the string being set to literally \n - the escape sequence doesn't seem to have meaning in the setting seditor. So how do I set a setting's value to a non-printable character?

The settings designer edits the App.config (xml) file and the Settings.settings file. I thought about editing the App.config file directly, but entering \n there again sets the string to literally \n.

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

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

发布评论

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

评论(2

只是一片海 2024-11-12 20:57:27

单击默认值编辑框中的向下箭头。要获取此内容(请注意灰色文本):

在此处输入图像描述

Click the down arrow in the Default value edit box. To get this (note the gray text):

enter image description here

半边脸i 2024-11-12 20:57:27

您的表单将有一个设计器文件 - formname.designer.csformname.designer.vb,具体取决于您使用的语言。您必须编辑此文件以包含换行符。

这是我建议触摸此文件的少数情况之一。大多数时候,它应该保持不变,并将您的更改放在表单的构造函数、InitializeComponent() 方法或事件行 OnLoad 或 OnActivate 中。

There will be a designer file that goes with your form — either formname.designer.cs or formname.designer.vb, depending on which language you use. You'll have to edit this file to include your newline.

This is one of the few cases where I ever recommend touching this file. Most of the time it should be left alone, and your alteration placed in your form's constructor, InitializeComponent() method, or an event line OnLoad or OnActivate.

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