Winform 中的 ByteViewer 控件,获取给定输入的 ANSI 值

ByteViewer Control in Winform, get ANSI value of the given input

.NET Framework 中有一个 ByteViewer 控件可直接使用。 如何从此控件获取 ANSI 格式的数据并将其分配给字符串变量?

我的输入将采用十六进制形式。

您必须使用 C# 编码将字节转换为字符串 class。我假设 ANSI 是 ISO-8859-1。

var bytes = byteViewer.GetBytes();
Encoding encoding = Encoding.GetEncoding("ISO-8859-1");
string result = encoding.GetString(bytes);