Time of Update: 2018-12-07
工作中經常需要自訂滑鼠樣式來更豐富更形象地互動操作,系統內建的樣式單一,難免會有些審美疲勞.取而代之,用一些比較形象的表徵圖來定義滑鼠樣式,使用者體驗上就更加形象了. 自訂滑鼠樣式Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->/// <summary> /// 自訂滑鼠樣式 /// </summary&
Time of Update: 2018-12-07
1. 如果函數沒有聲明, 應該在調用前定義:#include <stdio.h>/* 定義求大值函數 */int MAX(int x, int y) { if (x > y) return x; else return y;} /* 定義求小值函數 */int MIN(int x, int y) { return x 2. 可以在函數頭聲明:#include <stdio.h>int main(void){
Time of Update: 2018-12-07
字串數組:using System;class MyClass{ static void Main() { string[] arr = new string[3] { "aa", "bb", "cc" }; foreach (string s in arr) Console.WriteLine(s); // aa/bb/cc Console.ReadKey(); }}整數數組:using System;class MyClass{
Time of Update: 2018-12-07
官方的內容 http://en.wikipedia.org/wiki/C%2B%2B11The C++ Standards
Time of Update: 2018-12-07
1.避免鎖定public類型對象。 如果執行個體可以被公用訪問,將出現lock(this)問題。 如有一個類MyClass,該類有一個Method方法通過lock(this)來實現互斥: 1 public class MyClass 2 { 3 public void Method() 4 { 5 lock(this) 6 { 7 ...... 8 } 9 }10
Time of Update: 2018-12-07
原碼: 因為CPU只能做加法,於是人們想到了用這樣的辦法來實現減法:1 - 1 = 1 + (-1)這樣的話:二進位就是(00000001)原 + (10000001)原 = (10000010)原 = -2 /*原碼的二進位最高位0表示正,1表示負*/ 這樣做顯然結果是不正確的。不正確的原因是在進行加減運算時需要同時考慮數的符號和幅值這兩個因素!!!而且,這樣做還會帶來兩個0的情況:+0 = 00000000 -0 = 10000000.
Time of Update: 2018-12-07
.net中,其字串特有的駐留機制,保證了在同一進程中,相同字元序列的字串,只有一個執行個體,這樣能避免相同內容的字串重複執行個體化,以減少效能開銷。先來回顧一下c#中的代碼:View Code 1 public static void testString() 2 { 3 String s = "Abc"; 4 String s1 = "abc"; 5 String s2 = "abc";
Time of Update: 2018-12-07
C#中StringBuilder類的使用
Time of Update: 2018-12-07
Complete C# code:----------------using System;using System.ComponentModel;using System.Configuration;using System.Web.UI;using System.Web.UI.WebControls;namespace CustomGridView{/// <summary>/// Summary description for ClickableGridView/// <
Time of Update: 2018-12-07
string str5=Application.StartupPath;//擷取啟動了應用程式的可執行檔的路徑,不包括可執行檔的名稱。 //////////////////////////////////////////////// string str1 =Process.GetCurrentProcess().MainModule.FileName;//可獲得當前執行的exe的檔案名稱。 string
Time of Update: 2018-12-07
1 /**//// <summary>2 /// 得到要素類某欄位的唯一值3 /// </summary>4 /// <param name="pFeatureClass">要素類</param>5 /// <param name="strFld">指定要得到唯一值的欄位</param>6 ///
Time of Update: 2018-12-07
例1:#include <stdio.h>#include <string.h>int main(void){ char str[256]; scanf("%s", str); if (strlen(str) 例2:#include <stdio.h>int main(void){ int i = 0; while (1) { i++; printf("%d\n", i); if (i =
Time of Update: 2018-12-07
1. 結構數組:#include <stdio.h>int main(void){ struct Rec {int x,y;}; struct Rec rs[10]; size_t i; for (i = 0; i #include <stdio.h>int main(void){ struct Rec { char name[12]; short age; } rs[3] = {
Time of Update: 2018-12-07
數組參數屬於指標參數.指標參數即時傳址參數(或叫引用參數), 如果想在函數中修改參數的值, 這是唯一的途徑.如果把數組當作參數, 不管你願意與否, 它就是指標, 指向第一個值的指標.1. 數組參數就是指向第一個元素的指標:#include <stdio.h>void getArr(int p[], int si);int main(void){ int ns[] = {1,2,3,4,5}; getArr(ns, sizeof(ns)/sizeof(ns[0]));
Time of Update: 2018-12-07
像 printf 這種多參函數, 是借用 stdarg.h 中的宏實現的.va_list : 用於定義遍曆參數列表的指標;va_start : 讓指標指向第一個參數;va_arg : 擷取下一個參數, 並向後移動一個位置;va_end : 釋放指標, 完成遍曆.1. 整數求和:本例實現了對系列整數求和, 要求至少要有三個參數, 並且最後一個必須是 0.最後的 0 用於識別列表結束.#include <stdio.h>#include <stdarg.h>int
Time of Update: 2018-12-07
using System;class MyClass{ private int FNum; public delegate void MyDelegate(int n); /* 委託是事件的前提 */ public event MyDelegate MyEvent; /* 用 event 關鍵字根據已有的委託聲明事件 */ /* 假如是在給 Num 賦值時觸動事件 */ public int Num { get { return
Time of Update: 2018-12-07
建構函式建構函式的執行順序是先執行基類的建構函式,在執行子類的建構函式。這樣子類的建構函式中就可以調用積累的方法、屬性、成員。基類的建構函式如果聲明為private,子類將無法構造。如果提供了帶參數的建構函式,編譯器就不會自動提供預設的建構函式.只有沒有定義任何建構函式的情況下,編譯器才提供預設的建構函式。如果提供了帶有參數的建構函式,編譯器會認為這是唯一的建構函式,不會隱式的提供其他建構函式。靜態建構函式:目的是類有一些靜態欄位或屬性,需要在第一次使用類之前初始化。無參數;在代碼引用類以前只執
Time of Update: 2018-12-07
1.using System.Runtime.InteropServices; 2.import kernel32.dll 複製 儲存[DllImport("kernel32.dll", EntryPoint = "LCMapStringA")]public static extern int LCMapString(int Locale,int dwMapFlags,byte[] lpSrcStr,int cchSrc,byte[] lpDestStr,int cchDest);const
Time of Update: 2018-12-07
一、引言最近在設計模式的一些內容,主要的參考書籍是《Head First
Time of Update: 2018-12-07
格式化日期和數位字串經常要用到這個, 就把協助裡面的東西大概整理了一些列在這裡了. 下表描述了用來格式化 DateTime 對象的標準格式說明符。 格式說明符 名稱 說明 d 短日期模式 顯示由與當前線程關聯的 DateTimeFormatInfo.ShortDatePattern 屬性定義的模式或者由指定格式提供者定義的模式。D 長日期模式 顯示由與當前線程關聯的 DateTimeFormatInfo.LongDatePattern 屬性定義的模式或者由指定格式提供者定義的模式。t