使用String::Format("MyResult = %02X.", nSum);这种方式,最终得到的字符串是MyResult = %02X. 完全不是我想要的结果。
测试发现:使用ToString()方式倒是可以实现我想要的功能。
String ^str = "MyResult = ";
str += nSum.ToString("X2");
// 假如 nSum = 11, 此时得到的str就是MyResult = 0B
备注:
unsigned char u8HexData = Int32::Parse(tb_slaveAddr->Text, NumberStyles::HexNumber);
需要包含相应的包,如下:
using namespace System::Globalization;
---- The End.