c# 16进制显示转化
2016-07-04 20:22
531 查看
非原创。
接收16进制数据,在TextBox委托显示:
接收16进制数据,在TextBox委托显示:
private void readPortandShow() { char[] HexChar = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; byte receivebyte = (byte)serialPort1.ReadByte(); char hexH = HexChar[receivebyte / 16]; char hexL = HexChar[receivebyte % 16]; this.tBox.Invoke(new MethodInvoker(delegate { this.tBox.AppendText(hexH.ToString() + hexL.ToString() + " "); })); }
相关文章推荐
- C# Enum,Int,String的互相转换 枚举转换
- c#断点无效:"当前不会命中断点。没有与此行关联的可执行代码。可能的原因包括:条件编译或编译器优化"
- c# listView
- c# datagridview列头添加复选框实现全选
- C# 用interface和delgate实现回调-----配合索引器实现List
- C#中字符 '\0' 是a还是空格?
- [转]DataGridView 的右键菜单(ContextMenuStrip)
- C# 中的#if、#elif、#else、#endif等条件编译符号
- C# 获取一个13位的时间戳
- 【C#编写Windows服务】
- [转]C#多线程学习 之 线程池[ThreadPool]
- 值类型 引用类型 ref out
- C# IEnumerator, IEnumerable, and Yield
- C#==>匿名方法
- C#用DataTable实现Group by数据统计
- 【音乐拼接】mp3格式
- 【音乐拼接】WAV格式
- C#调用摄像头拍摄,截图,视频
- C# 命名异常
- 【TypeScript】如何在TypeScript中使用async/await,让你的代码更像C#。