在设置设计器中将字符串属性设置为 \n
在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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
单击默认值编辑框中的向下箭头。要获取此内容(请注意灰色文本):
Click the down arrow in the Default value edit box. To get this (note the gray text):
您的表单将有一个设计器文件 -
formname.designer.cs
或formname.designer.vb
,具体取决于您使用的语言。您必须编辑此文件以包含换行符。这是我建议触摸此文件的少数情况之一。大多数时候,它应该保持不变,并将您的更改放在表单的构造函数、InitializeComponent() 方法或事件行 OnLoad 或 OnActivate 中。
There will be a designer file that goes with your form — either
formname.designer.cs
orformname.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.