05 2012 档案
摘要:1.把/Files/wanghafan/CodeFolding.rar解压到..\eclipse\plugins2.重启eclipse3.首选项--java--编辑器--折叠,如图设置参数4.可以修改[start]为#region,[end]为#endregion5.应用后,点击快捷键Ctrl+小键盘/,进行切换
阅读全文
摘要:换行字数Window-Preferences-Java-Code Style-Formatter-Edit-Line Wrapping-General settings-Maximum line width:100删除空行1.打开源码编辑器2.使用快捷键Ctrl+f3.在Find输入框中输入:^\s*\n4.Replace With输入框的值为空5.在【Options】选中的"Regular expressions"6.点击【Replace All】按钮自动完成1. window→Preferences→java→Editor→Content Assist→Auto Act
阅读全文
摘要:1.模拟器横竖屏切换快捷键Ctrl+F112.写法: android:id="@+id/button1"android:text="@+text/Button"3.如果在运行Intent intent=new Intent(GPSActivity.this, ColorActivity.class); startActivity(intent);过程中报错,很可能是因为Mainfest.xml文件中未添加ColorActivity.xml文件为Activity
阅读全文
摘要:第一:搭建JAVA平台1.下载JDK1.6http://www.java.net/download/jdk6/6u10/promoted/b32/binaries/jdk-6u10-rc2-bin-b32-windows-i586-p-12_sep_2008.exe第二: 运行JAR文件运行JAR文件有2种方式a.直接运行打开方式→ 选择程序→浏览→选择javaw(C:\Program Files\Java\jdk1.6.0_10\bin路径下找)打开b.配置环境变量①.我的电脑→右键→属性→高级→环境变量找到path,编辑,在最末尾添加jdk路径;C:\Program Files\Java\
阅读全文
摘要:[一篮饭特稀原创,转载请注明出处http://www.cnblogs.com/wanghafan/archive/2012/05/18/2508113.html]四舍五入View Code 1 public static decimal Round(decimal d, decimal unit)2 {3 decimal rm = d % unit;4 decimal result = d - rm;5 if (rm >= unit / 2)6 result ...
阅读全文
摘要:Page_preInit (常用)Page_Init (常用) 主要完成页面初始化时运行(只运行一次)Page_InitCompletePage_PreLoadpage_Load (常用) 页面读放内存时运行,每次都会初触发page_LoadCompleteButton_Clickpage_PreRender(常用)Page_PreRenderCompletePage_SaveStateComplete protected void Page_PreInit(object sender, EventArgs e) { Response.Write("我执行了Page_PreInit&
阅读全文
摘要:单个文件的上传:保存到上传服务器指定目录: FileUpload1.Save(Server.MapPath("/upfiles/upload/") +FileUpload1.FileName);得到上传文件的文件名(含上传本地路径):FileUpload1.PostedFile.FileName;得到上传文件的大小:FileUpload1.PostedFile.ContentLength;得到上传文件上传类型:FileUpload1.PostedFile.ContentType;得到上传文件扩展名:System.IO.Path.GetExtension(FileUpload
阅读全文
摘要:FCKeditor是一款功能强大的开源在线文本编辑器(DHTML editor),使你在web上可以使用类似微软Word 的桌面文本编辑器的许多强大功能。FCKeditor目前的最新版本是2.6.3,本文以FCKeditor2.6.3介绍在asp.Net中的配置方法。FCKEditor官方下载地址:http://www.fckeditor.net/download在官方网站下载FCKeditor 2.6.3: FCKeditor_2.6.3.zipFCKeditor.Net :FCKeditor.Net_2.6.3.zip配置方法如下:一、删除不必要的文件从官方下载下来的FCKEditor2.
阅读全文
摘要:1 <asp:Repeater ID="DataListTolData" runat="server"> 2 <HeaderTemplate> 3 <table name="mitab" border="1" align="center" style="border-collapse:collapse;width:98%;word-break: break-all;"> 4 <tr class="Toptr_bg"
阅读全文
摘要:读取View Code 1 ConfigurationManager.AppSettings["isMail"]修改View Code 1 public static void SetValue(string path, string KeyName, string AppValue) 2 { 3 XmlDocument xDoc = new XmlDocument(); 4 xDoc.Load(path); 5 XmlNode xNode; 6 XmlElement xElem1; 7 xNode = xDoc.SelectSingleN...
阅读全文
摘要:<meta http-equiv="pragma" content="no-cache" /><meta http-equiv="cache-control" content="no-cache" /><meta http-equiv="expires" content="0" />
阅读全文
摘要:调用:View Code 1 int width = 190;2 int height = 190;3 Bitmap source = new Bitmap("c:\\someimage.jpg");4 System.Drawing.Image thumb = source.GetThumbnailImage(width,height,null,IntPtr.Zero);5 thumb.Save("C:\\someimageshot.jpg");6 thumb.Dispose();函数:View Code 1 public static Bitmap C
阅读全文
摘要:第一:private void Button1_Click(object sender, System.EventArgs e){ Response.Redirect(Request.Url.ToString())}第二:private void Button2_Click(object sender, System.EventArgs e){ Response.Write(" < script language=javascript>window.location.href=document.URL; < /script>")}第三:private
阅读全文
摘要://本地路径转换成URL相对路径View Code 1 private string urlconvertor(string imagesurl1)2 {3 string tmpRootDir = Server.MapPath(System.Web.HttpContext.Current.Request.ApplicationPath.ToString());//获取程序根目录4 string imagesurl2 = imagesurl1.Replace(tmpRootDir, “”); //转换成相对路径5 imagesurl2 = imagesurl2.Replace(@”\“, @”/
阅读全文
摘要:[一篮饭特稀原创,转载请注明出处http://www.cnblogs.com/wanghafan/archive/2012/05/10/2493864.html]js脚本正则判空和数字验证View Code 1 <script type="text/javascript"> 2 function CheckNullAndType() 3 { 4 var ErrorStr=''; 5 if($('#tb_FContractName').val().replace(/(^\s*)|(\s*$)/g, "")==
阅读全文
摘要:1.Web发布到IIS为网站假设端口为20000。2.配置HIMI类型: .xaml application/xmal+xml .xap application/x-silverlight-app3.用WinRAR解压Web\ClientBin\Strongsoft.FloodControl.Module.Contact.xap文件到磁盘上4.修改Strongsoft.FloodControl.Module.Contact\ServiceReferences.ClientConfig里面的<endpoint address节点"http://localhost:20000/Se
阅读全文
摘要:前提:ContactInfo对象有ID属性且有值 //DataGrid选中改变 private void dgContact_SelectionChanged(object sender, SelectionChangedEventArgs e) { MessageBox.Show(((ContactInfo)((DataGrid)sender).SelectedItem).ID.ToString()); }
阅读全文
摘要:System.Windows.Browser.HtmlDocument doc = System.Windows.Browser.HtmlPage.Document;if (doc.QueryString.Count > 0){ STNM = doc.QueryString["STNM"].ToString();}
阅读全文
摘要:[一篮饭特稀原创,转载请注明出处http://www.cnblogs.com/wanghafan/archive/2012/05/10/2493808.html]在SL和WPF中定义依赖项属性来设定属性系统中要实现设置IsTree为true,显示树状列表,否则显示下拉列表功能App.xaml.cs代码:View Code 1 private void Application_Startup(object sender, StartupEventArgs e)2 {3 //this.RootVisual = new MainPage();4 ...
阅读全文
摘要:[一篮饭特稀原创,转载请注明出处http://www.cnblogs.com/wanghafan/archive/2012/05/10/2493799.html]银光中ComboBox+TreeView构成自定义控件:思路1:textbox+button+treeview 缺点:不能跨ChildWindow、零散 [实现]思路2:ComboBox+TreeView+textbox 优点:可以跨ChildWindow [实现]+[推荐]思路3:ComboBox+TreeView 优点:可以跨ChildWindow、紧凑 [未实现]给出思路2的核心代码:xaml:View Code 1 <C
阅读全文
摘要:不规则 窗体 实现View Code 1 设置窗体属性TransparencyKey的颜色和需要屏蔽的颜色一致即可App.config读写View Code 1 读: 2 System.Configuration.ConfigurationSettings.AppSettings["KeyName"] 3 4 写: 5 XmlDocument doc = new XmlDocument(); 6 doc.Load(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile); 7 XmlNodeList nodes
阅读全文
摘要:低版本移到2010问题View Code 1 低版本转换成高版本2010出现无法加载方案的现象。2 解决办法:3 修改ASP.NET的项目文件*.csproj添加如下几行:(一般是Web页面层加)4 <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v8.0\WebApplications\Microsoft.WebApplication.targets" Condition="'$(Solutions.VSVersion)' == '8.0'
阅读全文
摘要:Repeater 强制保留两位小数View Code 1 <asp:Repeater ID="Repeater1" runat="server" onitemdatabound="Repeater1_ItemDataBound"> 2 <HeaderTemplate> 3 <table class="tb_Content" border="0" cellpadding="0" cellspacing="1"> 4 <
阅读全文
摘要:1.当使用线程的时候,一般设置线程IsBackground=true;表示后台线程,主进程在被结束的时候也会自动结束所有后台线程。当false;表示前台进程,在没有结束该线程之前是不能结束主进程的。2.当一个线程为后台线程的时候,它是不能直接操作前台控件的,因为前台WinForm控件都是COM控件,只能被主进程调用。这时候就要用Invoke的委托来调用。View Code 1 public Form1() 2 { 3 InitializeComponent(); 4 Close(); 5 bTime = e.BeginTime; 6 eTime = ...
阅读全文
摘要:建立View Code 1 public enum 基本费率类型 2 3 { 4 5 光缆运杂费, 6 7 电缆运杂费, 8 9 塑料运杂费,10 11 木材运杂费,12 13 水泥运杂费,14 15 其他运杂费,16 17 };遍历View Code 1 foreach (string s in Enum.GetNames(typeof(Global.特殊费率类型))){}
阅读全文
摘要:利用PictureBox和Panel实现使用滚动条浏览大图片View Code 1 由于Picturebox控件在显示图片时不能直接使用滚动条,所以必须借助Panel控件实现以滚动条的方式浏览大图片。具体操作步骤如下: 2 3 (1)新建一个Windows应用程序,命名为“scrollBar”,调整窗体到适当大小。更改“Form1.cs”为“FormScrollBar.cs”。 4 5 (2)切换到代码方式,添加名称空间引用: 6 7 using System.Drawing.Drawing2D; 8 9 (3) 在窗体上分别添加一个button控件命名为“butto...
阅读全文
摘要:判断文件属性 只读 设置 为 可写View Code 1 File.SetAttributes(文件路径, FileAttributes.Normal);当前操作目录View Code 1 System.IO.File.Exists(AppDomain.CurrentDomain.BaseDirectory +"InputModelDemo.xls")
阅读全文
摘要:Excel导入 数据库View Code 1 private void GetExcelData07(string str) 2 { 3 try 4 { 5 strCon = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" + str + "';Extended Properties='Excel 8.0;HDR=Yes;IMEX=1'"; 6 OleDbConnection myConn = new OleDbC...
阅读全文
摘要:[一篮饭特稀原创,转载请注明出处http://www.cnblogs.com/wanghafan/archive/2012/05/07/2487635.html]删除行View Code 1 protected void deleteDataRow(int RowID,DataTable dt)2 {3 for (int i = dt.Rows.Count - 1; i >= 0; i--)4 {5 if (Convert.ToInt32(dt.Rows[i]["RowID"]) == RowID)6 ...
阅读全文
摘要:遍历 HashTable DictionaryView Code 1 Dictionary<int, string> food = new Dictionary<int, string>(); // HashTable<int, string> food = new HashTable<int, string>(); 2 food.Add(1, "A"); 3 food.Add(2, "B"); 4 IDictionaryEnumerator myEnumerator=food.GetEnumerator(
阅读全文
摘要:打开Excel->工具->宏->Viaual Basic编辑器在弹出来的窗口中对着VBAproject点右键->插入->模块下面会出现一个名为"模块1",点击在右边的空白栏中粘贴以下内容:Function getpychar(char)tmp = 65536 + Asc(char)If (tmp >= 45217 And tmp <= 45252) Thengetpychar = "A"ElseIf (tmp >= 45253 And tmp <= 45760) Thengetpychar = &qu
阅读全文

浙公网安备 33010602011771号