Background color on TerminalControl

0 votes
asked Mar 24 by sp (140 points)

Is it limitaiton on trial version to set BackgroundColor?
I can not set any color than Black. I need change color of background to signalize error.
Thank you very much

1 Answer

0 votes
answered Mar 24 by Lukas Pokorny (120,490 points)

Hello, there are no limitations in the trial version, except the 30-day evaluation period.

However, the TerminalControl actually ignores the BackColor and ForeColor properties inherited from Windows Forms Control, because it does all the drawing by itself using its own palette.

Also, in the context of terminal emulation, the concept of "background color" is different from how it's used in Windows Forms, which is reflected by the behavior of terminal emulators.

Most systems use a color with index of 0 (black) as color for the background, so if you would like to temporarily change this to red, you can create a custom TerminalPalette, change the color at index 0, assign it to TerminalControl.Palette, and call Refresh() method to apply the new palette. But this will have an unintended side effect of also changing cells that use black for the foreground color. These would now use red foreground, because the palette applies to both foreground and background.

But it's never guaranteed that the background will actually be black. For example, Midnight Commander prefers blue, and other applications might have their own preferences.

Please note that it's the remote system, not the client, that is supposed to specify colors to use, although TerminalControl makes it possible to tweak the process a bit.

commented Mar 24 by sp (140 points)
Thank you very much :)