摘要: TS即是"Transport Stream"的缩写。他是分包发送的,每一个包长为188字节。在TS流里可以填入很多类型的数据,如视频、音频、自定义信息等。他的包的结构为,包头为4个字节,负载为184个字节(这184个字节不一定都是有效数据,有一些可能为填充数据)。工作形式: 因为在TS流里可以填入很多种东西,所以有必要有一种机制来确定怎么来标识这些数据。制定TS流标准的机构就规定了一些数据结构来定义。比如: PSI(Program Specific Information)表,所以解析起来就像这样: 先接收一个负载里为PAT的数据包,在整个数据包里找到一个PMT包的ID。然 阅读全文
posted @ 2011-07-27 15:31 静默虚空 阅读(487) 评论(0) 推荐(0) 编辑
摘要: 位操作方法代码如下:1. 设置字节中某位的值static public Byte s_SetBit(Byte byTargetByte, int nTargetPos, int nValue){ int nValueOfTargetPos = -1; if (nValue != 0 && nValu... 阅读全文
posted @ 2011-07-27 13:55 静默虚空 阅读(1559) 评论(0) 推荐(0) 编辑
摘要: weiFenLuo.winFormsUI.Docking.dll是开源项目DockPanel Suite的一个类库,可以实现像Visual Studio的窗口停靠、拖拽等功能。官方下载地址:http://sourceforge.net/projects/dockpanelsuite/具体操作可参考以下:1.建立一个WinForm工程,默认生成了一个WinForm窗体Form1。2.引用—>添加引用—>浏览—>weiFenLuo.winFormsUI.Docking.dll。3.窗体属性IsMdiContainer:True。4.工具箱—>右键—>选择项—>. 阅读全文
posted @ 2011-07-27 13:02 静默虚空 阅读(4195) 评论(0) 推荐(0) 编辑
摘要: 做一个文本编辑控件,设置字体的格式等功能必不可少。RichTextBox作为.Net提供的富文本控件,成为很多人做文本编辑器的首选。本文将要讨论就是针对RichTextBox控件的设置粗体、斜体、下划线等功能的相关问题。 首先我们看一段设置体的代码。 //设置粗体 private void toolStripButton4_Click(object sender, EventArgs e) { Font oldFont, newFont; oldFont = curRichTextBox.SelectionFont; if (oldFont.Bold) { newFont = new Fon. 阅读全文
posted @ 2011-07-27 12:38 静默虚空 阅读(13773) 评论(1) 推荐(0) 编辑
摘要: editorControl是一个userControl,其包含两个控件:左侧是一个用来显示行号的RichTextBox(使用label等均可),右侧是一个继承自RichTextBox的componenteditorGrid1。/*实现行号 begin*/(1) 添加事件 private void richTextBoxMain_TextChanged(object sender, EventArgs e) { updateLabelRowIndex(); } private void richTextBoxMain_FontChanged(object sender, EventArgs e) 阅读全文
posted @ 2011-07-27 12:32 静默虚空 阅读(7073) 评论(1) 推荐(2) 编辑
摘要: public static class StructCopyer { // 相当于序列化与反序列化,但是不用借助外部文件 //1、struct转换为Byte[] public static Byte[] StructToBytes(Object structure) { Int32 size = Marshal.SizeOf(structure); IntPtr buffer = Marshal.AllocHGlobal(size); try { Marshal.StructureToPtr(structure, buffer, false); Byte[] bytes = new Byte. 阅读全文
posted @ 2011-07-27 12:30 静默虚空 阅读(1325) 评论(0) 推荐(0) 编辑
摘要: 父窗框mainForm;子窗体childForm,利用事件进行传值在子窗体中的操作:public event EventHandler accept;public string value; private void btnStart_Click(object sender, EventArgs e) { value=txtName.text; if(accept!=null) { accept(this, EventArgs.Empty);//当事件触发时,传递自身引用 } }在父窗体中的操作:childForm frmChild=new childForm();private void b 阅读全文
posted @ 2011-07-27 12:27 静默虚空 阅读(990) 评论(2) 推荐(0) 编辑
摘要: namespace WindowsFormsApplication1{ public partial class Form1 : Form { public Form1() { InitializeComponent(); ... 阅读全文
posted @ 2011-07-27 12:22 静默虚空 阅读(2118) 评论(1) 推荐(2) 编辑