Time of Update: 2018-12-04
//write by wenhui.orgusing System;using System.IO;using System.Text;using System.Collections;namespace PDFGenerator{public class PDFGenerator{static float pageWidth = 594.0f;static float pageDepth = 828.0f;static float pageMargin = 30.0f;static
Time of Update: 2018-12-04
1。根據連結訪問web需要匯入的包(不知道是不是應該這麼說,以前用JAVA的,說習慣了)System.Net具體代碼:String url = "http://127.0.0.1/CORID/Login.asp?MailAddress=" + textBox1.Text.Trim() + "&Password=" + textBox2.Text.Trim();WebRequest wrt = WebRequest.Create(url); /
Time of Update: 2018-12-04
情況描述:對某些內部網路,要訪問外面,需要走代理投票刷票的時候,限制IP地址幹其他壞事 其實從.NET 2.0 開始,.NET開發的程式,利用代理訪問網路就已經很容易了,微軟 為我們封裝好了 WebProxy,我們所要做的,只是指定一下Proxy 伺服器的具體資訊就OK了 ,不羅嗦了,上代碼//需要使用的NameSpace: System.Net//程式碼片段//......using ( WebClient wc = new WebClient () ){ WebProxy wp =
Time of Update: 2018-12-04
註冊表是視窗系統的一個核心的資料庫,在這個資料庫中存放中與系統相關的各種參數,這些參數直接控制中系統的啟動、硬體的驅動程式安裝資訊以及在視窗系統上啟動並執行各種應用程式的註冊資訊等。這就意味著,如果註冊表因為某些原因受到了破壞,輕者是視窗系統啟動過程出現異常,重者就有可能導致整個系統的完全癱瘓。所以正確的認識註冊表,及時的備份註冊表,對於視窗使用者就顯得相當重要。 C#就可以十分方便、簡潔的開發出操作註冊表的程式。單擊"開始/運行",在"開啟"的後面填入"regedit"。就可以看到註冊
Time of Update: 2018-12-04
在日常應用中,常用的數值進位有10進位、8進位、16進位 和 2進位。在 .NET 裡,實現數制轉換可以說是非常簡單方便的, 大致的實現方式有兩種:比較通用的方式 System.Convert.ToInt?? ( ?, int fromBase )//fromBase表示原數的進位,可以為 2,8,16 System.Convert.ToString ( ?, int toBase)//toBase 是要轉換為的進位,可以為 2, 8, 16適用於10進位和16進位之間的互換
Time of Update: 2018-12-04
using System;using System.Collections.Generic;using System.Text;using System.Diagnostics;using System.Runtime.InteropServices;namespace ConsoleApplication22{ class Program { [DllImport("Ws2_32.dll")] public static extern uint
Time of Update: 2018-12-04
using System;using System.IO;using System.Text;using System.Runtime.InteropServices;class IniFileHandler{ [DllImport("KERNEL32.DLL")] public static extern uint GetPrivateProfileString(string lpAppName, string lpKeyName, string
Time of Update: 2018-12-04
C#中xml讀寫檔案的方法(xmlreader,xmlwriter)有幾種方法,可以看一下。http://fmouz.spaces.live.com/blog/cns!A3E6BF121783821A!22035.entry【轉】c#讀寫xml檔案入門方法 已知有一個XML檔案(bookstore.xml)如下:<?xml version="1.0" encoding="gb2312"?><bookstore> <book genre="fantasy"
Time of Update: 2018-12-04
C# 集合類 http://www.cnblogs.com/czyhsl/archive/2010/09/19/1831022.html C#操作XML小結http://www.cnblogs.com/zyf19860907/archive/2010/09/28/1837318.html C#實現控制項隨表單拖動而自動縮放其大小http://www.cnblogs.com/yuxuan/archive/2010/09/25/1834448.htmlC#實現表單和任意控制項的拖動http://
Time of Update: 2018-12-04
#region 截取圖象 /// <summary> /// 從圖片中截取部分產生新圖 /// </summary> /// <param name= "sFromFilePath "> 原始圖片 </param> /// <param name= "saveFilePath "> 產生新圖 </param>
Time of Update: 2018-12-04
private void button1_Click(object sender, EventArgs e) { RunWhenStart(false, "mystarton", @"C:/Program Files/UltraEdit/Uedit32.exe"); } /// <summary> /// 開機啟動項 /// </summary> ///
Time of Update: 2018-12-04
1、一個類,利用方法向線程傳資料。 //要傳的資料結構 public struct data { public string message; } //具體功能的方法,注意是object類型 static void ThreadMainWithPra(object o) { data d = (data)o;
Time of Update: 2018-12-04
//在Form的屬性中要設定 AlowDrop為true private void Form1_DragEnter(object sender, DragEventArgs e) { if (e.Data.GetData(DataFormats.FileDrop) != null) { e.Effect = DragDropEffects.Copy; }
Time of Update: 2018-12-04
[System.Runtime.InteropServices.DllImport("user32.dll ")] public static extern int SetWindowLong(IntPtr hWnd, int nIndex, int wndproc); [System.Runtime.InteropServices.DllImport("user32.dll ")] public static extern int GetWindow
Time of Update: 2018-12-04
在頁面page_load中: int num = 0; for (int i = 0; i < dt_data.Rows.Count; i++) { dgv.Rows.Add(); int n = dgv.Rows.Count - 1; for (int j = 2; j
Time of Update: 2018-12-04
private void Form1_Load(object sender, EventArgs e) { TimeSpan ts1 = new TimeSpan(DateTime.Now.Ticks); //擷取目前時間的刻度數 //你的代碼或者其他動作 double dout = 1; for (int i = 1; i <= 10; i++) {
Time of Update: 2018-12-04
[DllImport("User32.dll", EntryPoint = "FindWindow")] private static extern IntPtr FindWindow(string lpClassName, string lpWindowName); //添加引用 找到視窗控制代碼 private void button1_Click_1(object sender, EventArgs e) { IntPtr
Time of Update: 2018-12-04
private void Form1_Load(object sender, EventArgs e) { Hashtable ht = new Hashtable(); ht.Add("job", "a"); ht.Add("jobmon", "20"); //單個取值,方法比較特別 string a = ht["jobmon"].ToString();
Time of Update: 2018-12-04
private void myButton2_Click(object sender, EventArgs e) { //Execute("net user zero 0571m.com /add", 0); string output = Execute("ver" + "/r/n", 0); Console.WriteLine(output); } public static
Time of Update: 2018-12-04
//http://dotnet.chinaitlab.com/List_233.html private void button4_Click(object sender, EventArgs e) { //預覽功能,需要增加一個控制項:ThePrintDocument string strText = richTextBox1.Text;