社区
C#
帖子详情
如何在label中输入回车换行?/r/n没用
tianyaboy
2004-03-31 08:22:16
??
...全文
2637
13
打赏
收藏
如何在label中输入回车换行?/r/n没用
??
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
13 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
zhhahuatian
2004-03-31
打赏
举报
回复
首先你要明白转意字符,你可以输入“\\n\\r”,由于lable 中输入的是字符串,在字符串中好像和平时不同
liuyu202
2004-03-31
打赏
举报
回复
实在不行就多用几个Label了!
acui9937
2004-03-31
打赏
举报
回复
楼住的问题应该是这样的:
你需要进行转换
content = content.Replace("\n","<br>");
content = content.Replace("\r","<br>");
return content;
feelingbox
2004-03-31
打赏
举报
回复
<br>可不可以啊^_^
HNU
2004-03-31
打赏
举报
回复
很简单
在Text属性中多输入空格,文字碰到边框就会自动换行。
和VC不一样
:)
tianyaboy
2004-03-31
打赏
举报
回复
真奇怪啊,代码里修改添加回车换行可以,对应的Text属性里居然对应添加了看不件的空格
我问的就是要在属性Text中设置,难道真的不可以吗?
marvelstack
2004-03-31
打赏
举报
回复
下面使用,不过楼主要把Label拉得足够大。
public class MainForm : System.Windows.Forms.Form
{
private System.Windows.Forms.Label label1;
private System.ComponentModel.Container components = null;
public MainForm()
{
InitializeComponent();
this.label1.Text = @"第一行
第一行
第二行
第三行
第四行";
}
#region
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
if (components != null)
components.Dispose();
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// label1
//
this.label1.Location = new System.Drawing.Point(152, 56);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(168, 96);
this.label1.TabIndex = 0;
this.label1.Text = "label1";
//
// MainForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(496, 325);
this.Controls.Add(this.label1);
this.Name = "MainForm";
this.Text = "MainForm";
this.ResumeLayout(false);
}
#endregion
#endregion
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new MainForm());
}
}
KentYu
2004-03-31
打赏
举报
回复
楼主搞错了吧?:)
tianyaboy
2004-03-31
打赏
举报
回复
label1.Text = ??;是回车换行
tianyaboy
2004-03-31
打赏
举报
回复
\r\n
输入后显示“\r\n”!
孟子E章
2004-03-31
打赏
举报
回复
\r\n
or
System.Environment.NewLine;
一个用C#写的删除字符串
中
回车
、
换行
、制表符、空格的程序
2019独角兽企业重金招聘Python工程师标准>>> ...
antd
中
table组件
中
如何进行
换行
操作(react
中
)
antd
中
table组件
中
如何进行
换行
操作(react
中
)说明效果数据代码 说明 react项目,遇到某字段对应的单元格内需要
换行
。 最初想偷懒,尝试了在数据
中
加入
回车
、使用模板字符串、转义字符,都
没用
。 最后实现方法是在antd渲染column的对象对应的字段
中
加入render属性实现。 效果 数据 代码 { title: '字段名', width: 200, align: center, render: (str, colu
ElementUI 表格内容不识别 \n
换行
符
增加样式: .el-table .cell { white-space: pre-line; } <el-table-column align="left" width="400px" prop="title"
label
="标题" :formatter="wrapText" > </el-table-column> w
c#
中
用键盘控制发送的方法
例如:设置俩个textBox //用enter建发送信息 //KeyCode获取键盘上的键 选择enter键 if (e.KeyCode == Keys.Enter) { //使button2_Click链接enter键 this.button2_Click(sender, e); ...
python-Tkinter图形界面
Label
控件 import tkinter # 创建主窗口 win = tkinter.Tk() # 设置标题 win.title("yudanqu") # 设置大小和位置 win.geometry("400x400+200+50") '''
Label
:标签控件,可以显示文本 ''' # win:父窗体 # text:显示的文本内容 # bg:背景色 # fg:字体颜色 # font:字体 # wraplength:指定text文本
中
多宽之后
换行
# justify:设置
换行
后的对齐方式 # anch
C#
111,119
社区成员
642,555
社区内容
发帖
与我相关
我的任务
C#
.NET技术 C#
复制链接
扫一扫
分享
社区描述
.NET技术 C#
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧
+ 用AI写文章