如何禁用RTFTextBox中某些文本部分的换行? [英] How to disable wrapping on some text part in RTFTextBox?

查看:198
本文介绍了如何禁用RTFTextBox中某些文本部分的换行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个文本框,显示国际象棋游戏的动作.我需要防止在行尾出现类似"5. Ke4-e6"的问题.我可以使用不间断的连字符和不间断的空格,但是它仍然会在点处断开.

我认为RTF中一定有一些东西可以做到这一点...

谢谢你的帮助. :) Eiko

解决方案

 richTextBox1.WordWrap =  false ;  pre> 


您为什么要使用RTF文本框?是不是DataGridView方式更高效,更美观?

您可以用两列制作一个,移动编号和实际详细信息用一列.这样,人们就可以对移动的升序或降序进行排序,并且可以像检查DataGrid内部的计数一样轻松地对所有移动进行计数.

我知道这不是您提出问题的答案..只是一个建议:)

 DataGridView dataGridView =  DataGridView();
dataGridView.Columns.Add(" " #");
dataGridView.Columns.Add(" " 详细信息");

// 添加移动时; 
dataGridView.Rows.Add((dataGridView.Count +  1 )," ); 


DataGridView在这里不是真正的选择,因为文本不仅以表格形式显示,而且还以表格形式显示作为文字,即变体形式:

1. e2-e4 e7e5
(也可以是1. d2-d4)

这个例子是简单而简短的,但是您明白了……我不想在"1. d2-d4"内休息,否则团队会杀了我:-)


I have a textbox showing the moves of a chess game. I need to prevent that someting lik "5. Ke4-e6" breaks up at the end of the line. I can use non-breaking hyphens and non-breaking spaces, but then it will still break at the dot.

I figure there must be something in RTF that gets this done...

Thanks for your help. :) Eiko

解决方案

richTextBox1.WordWrap = false;


Why exactly are you using a RTF textbox? Isn''t a DataGridView way more efficient and better looking?

You could make one with 2 columns, One for the Move number and the actual details. That way people can sort the moves ascending or descending and is counting all the moves as easy as checking the count number inside the DataGrid.

I know this is not an awnser to your question.. just a suggestion :)

DataGridView dataGridView = new DataGridView();
dataGridView.Columns.Add("Id", "#");
dataGridView.Columns.Add("Details", "Details");

// When adding a move;
dataGridView.Rows.Add((dataGridView.Count + 1), "* Your string with details");


DataGridView is no real option here, as the text is not only presented as a table, but also as flowing text, i.e. in variants:

1. e2-e4 e7e5
(Also possible is 1. d2-d4)

The example is trivial and short, but you get the point... I don''t want breaks within "1. d2-d4", or the team will kill me :-)


这篇关于如何禁用RTFTextBox中某些文本部分的换行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆