上一页 1 ··· 36 37 38 39 40
摘要: 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 静默虚空 阅读(7072) 评论(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 静默虚空 阅读(1320) 评论(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 静默虚空 阅读(989) 评论(2) 推荐(0) 编辑
摘要: namespace WindowsFormsApplication1{ public partial class Form1 : Form { public Form1() { InitializeComponent(); ... 阅读全文
posted @ 2011-07-27 12:22 静默虚空 阅读(2117) 评论(1) 推荐(2) 编辑
上一页 1 ··· 36 37 38 39 40