Ozt*_*aco 3 c# algorithm text label winforms
假设我有一个Label内部Panel.文本将比Panel有时更大,但并非总是如此.我怎么能弄清楚我应该在"..."前面的文字的哪一部分,而不是硬编码它将需要多少个字符,因为每个字符的大小都不一样.
if (bigLabel.Width >= this.ClientRectangle.Width - 10) {
dotLabel.Location = new Point(this.ClientRectangle.Width - 10 - dotLabel.Width);
}
else {
dotLabel.Location = new Point(this.Width + 10, this.Height + 10);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2061 次 |
| 最近记录: |