I have a strange request.
Indeed. Very unusual. I doubt such a thing exists out of the box for download.
There seem to be ways of implementing it without turning the text into a pixel graphics. The following code provides a "normal" TextBox that does not let you remove text.
Benefit of such a solution compared to turning it into a pixel graphics is: it is still text and can be treated as such, e.g. for saving it into a text file. You can send it to someone else for further editing, which would be pretty hard if the text is a pixel graphics.
If money is not a problem, someone on https://www.fiverr.com/ with macOS background will implement it for you, maybe even with some features like saving and loading. Should be a nice and interesting 30$ task for some 15 year old script kiddie.
I never programmed C# code for macOS, but Visual Studio Code and Mono might be able to handle it. Here's the core logic:
public class NoDeleteTextBox : TextBox
{
public NoDeleteTextBox()
{
ShortcutsEnabled = false;
Multiline = true;
}
void RemoveSelection()
{
SelectionLength = 0;
SelectionStart = Text.Length;
}
protected override void OnKeyDown(KeyEventArgs e)
{
// prevent deletion
if (e.KeyCode == Keys.Delete || e.KeyCode == Keys.Back)
{
e.SuppressKeyPress = true;
}
// prevent selection
if (e.KeyCode == Keys.A && e.Modifiers == Keys.Control)
{
e.SuppressKeyPress = true;
RemoveSelection();
return;
}
// prevent movement
if (e.KeyCode == Keys.Left || e.KeyCode == Keys.Right ||
e.KeyCode == Keys.Up || e.KeyCode == Keys.Down ||
e.KeyCode == Keys.PageUp || e.KeyCode == Keys.PageDown ||
e.KeyCode == Keys.Home || e.KeyCode == Keys.End)
{
e.SuppressKeyPress = true;
}
base.OnKeyDown(e);
}
protected override void OnMouseDown(MouseEventArgs e)
{
RemoveSelection();
}
protected override void OnMouseUp(MouseEventArgs e)
{
RemoveSelection();
}
protected override void OnClick(EventArgs e)
{
RemoveSelection();
}
}