代码改变世界

iframe 父页面与子页面之间的方法的相互调用

2013-12-23 16:58 by 无聊玩博客, 44336 阅读, 3 推荐, 收藏, 编辑
摘要:Parent Page This is the Parent Page. Child Page This is the Child Page. 阅读全文

ajax 小记

2013-12-05 11:30 by 无聊玩博客, 154 阅读, 0 推荐, 收藏, 编辑
摘要:var options = { type : 'POST',//请求类型,post or get url : "FinishInstallationAction",//后台action data : $.param({ jsonPageModel : strpagemodel, id : gci_id }, true),//给后台的参数 success : function(r, status) { //r是后台的返回结果 window.location = $("base").attr("href") + " 阅读全文

html <input type="text" />加上readonly后在各种浏览器的差异。

2013-12-05 11:21 by 无聊玩博客, 4556 阅读, 0 推荐, 收藏, 编辑
摘要:Name: Country: 上述代码在ie中:可以获得焦点,光标可进入,不能输入,但是按backspace键后,页面会后退跳转。 在chrome中:可以得到焦点,光标不可进入 在firebox中:可以得到焦点,光标也可进入。按backspace键,不起任何作用。 阅读全文

.net使用外部程序集拓展功能

2013-05-24 13:28 by 无聊玩博客, 172 阅读, 0 推荐, 收藏, 编辑
摘要:以windows窗体应用程序为例。第一步,建立一个程序集,它包含能将插件插入可拓展windows窗体应用程序中的类型。using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace CommonSnappableTypes{ //为可插入拓展windows窗体应用程序的所有插件提供一个多态接口 public interface IAppFunction { void Doit(); } //顺便提一个特性 [Attribute... 阅读全文

类型反射与晚期绑定

2013-05-24 09:33 by 无聊玩博客, 311 阅读, 0 推荐, 收藏, 编辑
摘要:在.net中,反射是一个运行库类型发现的过程。使用反射服务,可以得到一个给定*.dll或*.exe程序集所包含的所有类型的列表。命名空间System.Reflection包含了大量与反射相关的类型,要理解如何使用System.Reflection命名空间编程读取.net元数据,首先要理解System.Type类型System.Type类型定义了很多成员,可以用来检测某个类型的元数据,它们返回的类型大多数位于System.reflection命名空间中。如:Type.GetMethods()返回一个MethodInfo类型的数组。Type类型的各种成员就不一一列举。下面是得到Type类型的三种方 阅读全文

C#调用非托管代码(C++方法)的2种方式

2013-05-14 15:53 by 无聊玩博客, 611 阅读, 0 推荐, 收藏, 编辑
摘要:第一种:静态调用使用using System.Runtime.InteropServices命名空间下的DllImport标签指定非托管的Dll及其细节方法必须是静态的即必须加上static关键字,还有extern关键字 [DllImport("kernel32.dll", EntryPoint = "GetSystemDefaultLCID")] static extern ushort GetSystemDefaultLCID();//OS 当前选择的默认语言(区域-管理) [DllImport("kernel32.dll", E 阅读全文

构建可终结类型和可处置类型

2013-05-14 15:14 by 无聊玩博客, 214 阅读, 0 推荐, 收藏, 编辑
摘要:class MyReSourceWrapper:IDisposable { private bool disposed = false; ~MyReSourceWrapper() { //在这里清除非托管资源 CleanUp(false); Console.WriteLine("******* In Finalize!*******");//仅仅为了测试 //不要调用任何对象的Dispose() } public void Dis... 阅读全文

C#求解哈夫曼树

2013-04-22 13:56 by 无聊玩博客, 349 阅读, 0 推荐, 收藏, 编辑
摘要:C#求解哈夫曼树,树是用数组保存的 class HuffmanTree { private Node[] data; public int LeafNum { get; set; } public Node this[int index] { get { return data[index]; } set { data[index] = value; } } public HuffmanTree(int n) { data... 阅读全文

几种获取操作系统语言的方法及其相似点与不同点

2012-12-03 15:07 by 无聊玩博客, 1511 阅读, 0 推荐, 收藏, 编辑
摘要:[DllImport("kernel32.dll", EntryPoint = "GetSystemDefaultLCID")] public static extern ushort GetSystemDefaultLCID();//OS 系统自己的语言(区域-管理) [DllImport("kernel32.dll", EntryPoint = "GetSystemDefaultLangID")] public static extern ushort GetSystemDefaultLangID();//OS 阅读全文