開發過程中用到的一些知識

2022-02-24 04:01:59 字數 1678 閱讀 7287

在後台給前台控制項賦值16進製制的顏色

控制項名.background = new solidcolorbrush((color)colorconverter.convertfromstring("

#ff54c0dc

"));

wpf監控方法

timer timer;

timer = new system.threading.timer(new timercallback(mydelegate)); //

例項化乙個timer時間器並啟動

timer.change(0, 1000

);delegate

void

updatetimer();

void mydelegate(object

state)

//需要實現的方法

void

myeventfunc()

另外一種

dispatchertimer t = null

;下面的可以寫在load事件裡面

t = new

dispatchertimer();

t.interval = new timespan(0, 0, 1

);t.tick +=ontimer;

t.isenabled = true

;t.start();

在別的地方實現ontimer方法

c# 輕鬆獲取路徑中檔名、目錄、副檔名等

string path = "

c:\\dir1\\dir2\\foo.txt

";

string str = "

getfullpath:

" + path.getfullpath(path) + "

\r\n

";

str += "

getdirectoryname:

" + path.getdirectoryname(path) + "

\r\n

";str += "

getfilename:

" + path.getfilename(path) + "

\r\n

";

str += "

getfilenamewithoutextension:

" + path.getfilenamewithoutextension(path) + "

\r\n

"; str += "

getextension:

" + path.getextension(path) + "

\r\n

";str += "

getpathroot:

" + path.getpathroot(path) + "

\r\n

"; messagebox.show(str);

結果:

getfullpath:c:\dir1\dir2\foo.txt

getdirectoryname:c:\dir1\dir2

getfilename:foo.txt

getfilenamewithoutextension:foo

getextension:.txt

getpathroot:c:\

Android開發過程中用到的設計模式

1 模板模式 如activity 每次新建乙個actiivty時都會覆蓋oncreate,onresume,onstart等方法,這些方法在 父類中就相當於乙個模板。2 觀察者模式 listener都相當於乙個觀察者,對一些事件的響應都進行觀察,當發現有響應就進行做相應的處理 3 單例模式 目的 希...

GitBook部署過程中用到的一些指令

2 安裝gitbook 首先設定npm上網 npm config set proxy http user password proxy host proxy port注1 在配置時輸入的配置命令列都可以在c盤user目錄下的使用者名稱目錄中的.npmrc找到 用notepad開啟 注2 執行npm指...

分享一些我在開發過程中用過的資源

以下所提到的控制項 元件均為開源或免費的。1,combobox控制項 upgrade your select element to a combo box 2,datetimepicker控制項 graymettersoft 3,tabstrip控制項 a asp.net webtabstripus...