gpt4 book ai didi

c# - 删除 .NET RichTextBox 中的特定行

转载 作者:行者123 更新时间:2023-11-30 13:25:03 27 4
gpt4 key购买 nike

如何删除 RichTextBox 中的特定文本行?

最佳答案

另一种解决方案:

private void DeleteLine(int a_line)
{
int start_index = richTextBox.GetFirstCharIndexFromLine(a_line);
int count = richTextBox.Lines[a_line].Length;

// Eat new line chars
if (a_line < richTextBox.Lines.Length - 1)
{
count += richTextBox.GetFirstCharIndexFromLine(a_line + 1) -
((start_index + count - 1) + 1);
}

richTextBox.Text = richTextBox.Text.Remove(start_index, count);
}

关于c# - 删除 .NET RichTextBox 中的特定行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1329347/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com