[英]How can I create a button when a user click all selected text must be align on the center of rich textbox in c#
Hie, I have tried my best to create a button when a user click all selected text must be align on the center of rich textbox in c# but Am still getting what I don't want.嗨,当用户单击所有选定的文本必须在 c# 中的富文本框的中心对齐时,我已尽力创建一个按钮,但我仍然得到我不想要的东西。 So please can somebody help me please.
所以请有人可以帮助我。
In your button's click event try this code:在你的按钮的点击事件中试试这个代码:
private void button1_Click(object sender, EventArgs e)
{
richTextBox1.SelectionAlignment = HorizontalAlignment.Center;
}
then you can center-align the selected part of text.然后您可以居中对齐文本的选定部分。
尝试
richTextBox.SelectionAlignment = HorizontalAligment.Center;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.