[英]How to align one line in a textbox c#
I'm trying to make a calculator where the result of the calculation should display on the right side instead of the left.我正在尝试制作一个计算器,计算结果应该显示在右侧而不是左侧。
Unfortunately, you can't use tbx_main.TextAlign = HorizontalAlignment.Right;
不幸的是,您不能使用
tbx_main.TextAlign = HorizontalAlignment.Right;
since it makes the whole text align on the right.因为它使整个文本在右侧对齐。 It would really be useful if there was a way like
\\t
where that row only gets dragged to the right.如果有一种像
\\t
这样的方法,该行只会被拖到右边,那真的很有用。 I'm unsure if there even is a solution to this...我不确定是否有解决方案...
you can use TextBox.TextAlign Property if you are are using Windows Forms如果您使用的是 Windows 窗体,则可以使用 TextBox.TextAlign 属性
https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.textbox.textalign?view=netframework-4.8 https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.textbox.textalign?view=netframework-4.8
for WPF TextBox.TextAlignment Property for WPF https://docs.microsoft.com/en-us/dotnet/api/system.windows.controls.textbox.textalignment?view=netframework-4.8用于 WPF 的 WPF TextBox.TextAlignment 属性https://docs.microsoft.com/en-us/dotnet/api/system.windows.controls.textbox.textalignment?view=netframework-4.8
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.