2011-10-25

控制 Hint 顯示時間

在Delphi中若想要讓原件的Hint顯示久一點的話,
可以透過參數設定修改!

Application.HintHidePause := 5000;//**顯示時間 單位為毫秒,即5秒

其他參數
Application.HintPause//**延遲時間
Application.HintColor//**顏色

以上可在Form Create時設定即可!

2011-10-21

Win7下使用Delphi7

當在Win7下面安裝完Delphi執行時會出現檔案無法異動的錯誤訊息,
這是因為資料夾檔案權限問題,修改下述目錄權限即可!

1.修改 C:\Program Files\Borland\Delphi7\Bin 目錄權限,安全性中新增users有modify權限
2.修改 C:\Program Files\Borland\Delphi7\Projects 目錄權限,安全性中新增users有modify權限

2011-08-11

Delphi利用ADOQuery直接讀取Excel內容

在ADOQuery的ConnectionString設定
Provider=Microsoft.Jet.OLEDB.4.0;Data Source='檔案路徑';
Extended Properties=Excel 8.0;Persist Security Info=False';

SQL輸入 select * from [Sheet1$]
<分頁名稱一定要用[]包起來>

ADOQuery Open後Excel的第一欄會變成FieldName,
下面的開始才是明細資料

使用完畢記得將ADOQuery Free掉,避免Excel檔案被鎖定無法正常開啟

2011-07-13

Firefox 設定暫存檔放至RamDisk

將瀏覽的暫存檔放至RamDisk中,可加快瀏覽的速度

about:config
browser.cache.disk.parent_directory-->X:\
重新開啟Firefox即可

註:x:\為RamDisk的位置

2011-07-12

firefox 4、firefox 5 使用 MacType 破字

因firefox 4、firefox 5版本內建開啟GPU功能,
雖然可以加快圖形的運算降低CP使用率,
但是如果有使用MacType美化字形,
會發現有破字的情況發生,
在config內修改下述參數即可正常顯示!

about:config
gfx.direct2d.disabled-->True
gfx.font_rendering.directwrite.enabled-->False
mozilla.widget.render-mode-->0

設定完畢重新開啟Firefox即可!

2011-05-20

Win7 關閉休眠功能

使用系統管理員身分開啟命令提示字元

關閉休眠 powercfg -h off
啟動休眠 powercfg -h on

Win7 啟用Administrator帳號

使用系統管理員身分開啟命令提示字元
啟用Administrator帳號 net user administrator /active:yes

設定密碼 net user administrator password
停用帳戶 net user administrator /active:no

Delphi 求商數、餘數

求商數 10 DIV 3 = 3
求餘數 10 MOD 3 = 1

2011-05-19

update 使用 case when

更新資料時若需經過case when給對應的值,
下列範例可達到要求。
update HBSpecM set PURWgt=(case when PUR.QtyCH is NULL then 0 else PUR.QtyCH end)
from HBSpecM HBM left join
	(select D.BookNum,HBM.ProdNo,QtyCH=SUM(QtyCH)
	from PUR510D D left join HBMatAnti HBM on D.CorpNo=HBM.CorpNo and D.ProdNo=HBM.AntiProdNo
	where D.CorpNo='20001'
	group by D.BookNum,HBM.ProdNo) PUR on HBM.BookNum=PUR.BookNum and HBM.ProdNo=PUR.ProdNo
where HBM.CorpNo='20001'

update 使用 left join

更新資料時若參照的資料需外部合併,
下列範例可達到要求。
update HBSpecM set PURWgt=PUR.QtyCH
from HBSpecM HBM left join
    (select D.BookNum,HBM.ProdNo,QtyCH=SUM(QtyCH)
        from PUR510D D left join HBMatAnti HBM on D.CorpNo=HBM.CorpNo and D.ProdNo=HBM.AntiProdNo
        where D.CorpNo='20001'
        group by D.BookNum,HBM.ProdNo) PUR on HBM.BookNum=PUR.BookNum and HBM.ProdNo=PUR.ProdNo
where HBM.CorpNo='20001'