Time of Update: 2018-12-06
在windows 編程中用到最多的就是控制項的事件了,微軟給我們很好的方式,把注意力放到事件執行方法的設計和編碼上,但是但我們真正弄懂了事件的真正出發執行原理的話,對我們的編程的提高真是非常有協助的,例如在windows編程中,如果我單擊了一個button按鈕觸發了button 的click事件 Button1_Click(){} ,但是我們編程的時候,不但想要觸發button 的單擊事件,還想要把其他的事件接下來順序執行,要實現這種方式,除了在方法最後對其他方法的調用,還可以利用將其他需要
Time of Update: 2018-12-06
今天遇到了用線程調用帶函數,但是如果運用常規想法是行不通的,如下代碼: HistoryRecord hr = new HistoryRecord(); DateTime StartTime = new DateTime(2007, 12, 3, 16, 18, 36); DateTime EndTime = new DateTime(2007, 12, 4, 16, 19, 59); Thread t = n
Time of Update: 2018-12-06
一.什麼是Attribute先看下面的三段代碼:1.自訂Attribute類:VersionAttribute[AttributeUsage(AttributeTargets.Class)] public class VersionAttribute : Attribute { public string Name { get; set; } public string Date { get; set; } public string Describtion {
Time of Update: 2018-12-06
一、委託委託類似於函數指標,但函數指標只能引用靜態方法,而委託既能引用靜態方法,也能引用執行個體方法。委託使用分三步:1、委託聲明。2、委託執行個體化。3、委託調用。常式一: using System;namespace 委託{ delegate int NumOpe(int a,int b); //委託聲明 class Class1 { static void Main(string[] args) { Class1 c1 = new Class1();
Time of Update: 2018-12-06
原文連結:http://hi.baidu.com/liyanlin84/blog/item/d235402483d0f7358644f96b.htmlC#代碼與javaScript函數的相互調用問:1.如何在JavaScript訪問C#函數?2.如何在JavaScript訪問C#變數?3.如何在C#中訪問JavaScript的已有變數?4.如何在C#中訪問JavaScript函數?問題1答案如下:javaScript函數中執行C#代碼中的函數:方法一:1、首先建立一個按鈕,在後台將調用或處理的內
Time of Update: 2018-12-06
C# 2.0中泛型程式設計初級教程 C# 2.0,與C#
Time of Update: 2018-12-06
本篇介紹如何分別在c#,MFC,WIN32程式中移動無標題視窗 C# C#中總結起來有兩種方法: 1.自己控制,滑鼠左鍵點擊、移動時表單的狀態,代碼見下: Point offSet; privatevoid frm_MouseDown(object sender, MouseEventArgs e){ offSet =new Point(-e.X, -e.Y); } privatevoid frm_MouseMove(object sender,
Time of Update: 2018-12-06
以前本人用C#製作過一些小遊戲的外掛,其中一步最重要的原理是截取電腦的螢幕,然後分析關鍵像素點的資訊。現在用C++重用這些程式時,在截屏上遇到一些問題,現在終於解決了,貼出自己整理後的代碼。分為win32代碼和MFC代碼,如下 1 void Test_captrueScreenwin32() 2 { 3 HDC hDesktopDc=CreateDC(_T("DISPLAY"), NULL, NULL, NULL); 4 int
Time of Update: 2018-12-06
前言如果需要處理許多位,就可以使用類 BitArray 和結構 BitVector32。BitArray 位於命名空間System.Collections,BitVector32 位於命名空間 System.Collections.Specialized。 一、BitArray 類 參考型別類 BitArray 是一個參考型別,包含一個 int 數組,每 32 位使用一個新整數個人理解:BitArray相當於一個bool類型的數組bool[]官方解釋:類 BitArray 是一個參考型別,
Time of Update: 2018-12-06
在網上發現這篇文章,收藏 時刻看看 學習學習(轉) 1. 避免將多個類放在一個檔案裡面。 2. 一個檔案應該只有一個命名空間,避免將多個命名空間放在同一個檔案裡面。3. 一個檔案最好不要超過500行的代碼(不包括機器產生的代碼)。 4. 一個方法的代碼長度最好不要超過25行。5. 避免方法中有超過5個參數的情況。使用結構來傳遞多個參數。 6. 每行代碼不要超過80個字元。 7. 不要手工的修改機器產生的代碼。 a) 如果需要編輯機器產生的代碼,編輯格式和風格要符合該編碼通訊協定。b)
Time of Update: 2018-12-06
1 c#之process類相關整理 2 2010-06-11 10:55 3 4 一、根據進程名擷取進程的使用者名稱? 5 6 需要添加對 System.Management.dll 的引用 7 8 using System.Diagnostics; 9 using System.Management; 10 11 static void Main(string[] args) 12 { 13 foreach (Process p in
Time of Update: 2018-12-06
進程啟動或結束監控 代碼: 1 //注意:引用System.Management.dll 和 using System.Management; 2 3 staticvoid Main(string[] args) 4 5 { 6 7 //建立WQL事件查詢,用於執行個體建立 8 9 var qCreate =newWqlEventQuery("__InstanceCreationEvent",10 11
Time of Update: 2018-12-06
1 //取漢字首字母 2 private string GetChineseSpell(string strText) 3 { 4 int len = strText.Length; 5 string myStr = ""; 6 for (int i = 0; i < len; i++) 7 { 8 myStr +=
Time of Update: 2018-12-06
文章目錄 轉自:http://www.admin10000.com/document/998.html指標、引用和取值void指標、NULL指標和未初始化指標指標和數組指標與結構體總結
Time of Update: 2018-12-06
1 public static int BinSort(int[] array,int key) 2 { 3 int low = 0; 4 int high = array.Length - 1; 5 int mid = 0; 6 int n = 0; 7 while (low <= high) 8 { 9 n++;10 mid = (low + high) / 2;11
Time of Update: 2018-12-06
轉自http://www.cnblogs.com/xh831213/archive/2006/02/13/329638.htmlCodeCode highlighting produced by Actipro CodeHighlighter
Time of Update: 2018-12-06
最近將C#.net中常用的函數和方法進行了匯總,希望對大家有所協助。1、DateTime 數字型 System.DateTime currentTime=new System.DateTime(); 1.1 取當前年月日時分秒 currentTime=System.DateTime.Now; 1.2 取當前年 int 年=currentTime.Year; 1.3 取當前月 int 月=currentTime.Month; 1.4 取當前日 int 日=currentTime.Day; 1.5
Time of Update: 2018-12-06
private void btnPrint_Click(object sender, EventArgs e) { SendKeys.Send("%{PRTSC}"); Application.DoEvents(); this.printDocument1.Print(); } private void printDocument1_PrintPage(object sender,
Time of Update: 2018-12-06
C#中沒有設定系統熱鍵的方法,需要調用系統API來實現。在網上找了段代碼,自己實踐了一下很好用,記錄下來以方便以後使用。HotKey類代碼如下:using System;using System.Collections.Generic;using System.Text;using System.Collections;using System.Windows.Forms;using System.Runtime.InteropServices;public class Hotkey :
Time of Update: 2018-12-06
一般在給伺服器上發布網站時,都需要刪除伺服器上已存在的檔案,以加快上傳速度。每次都要手動刪除,很麻煩。刪錯發布後就悲劇了。使用bat批次檔有沒有,替換檔案內容功能,所以就自己做了個移除工具。用法:在要刪除的目錄根目錄建立del.txt內容格式可如下: //刪除web\images目錄rd web\images//刪除所有的js目錄rd js /s//刪除檔案del *.exe /sdel images\*.jpgdel