科技

2012年3月13日 星期二

[MFC]將picture control 填滿底色

最近遇到一個需要將picture control填滿底色的小程式

就順手把這程式放上來吧


CStatic   *pStatic   =   (CStatic  *)GetDlgItem(IDC_SHOW);//定義IDC_SHOW這個picture control物件
CDC *pDC = pStatic->GetDC();//pDC為代表pStatic這個物件的device
CRect rct;//建立一個矩形座標系,左上角為(0,0) 往右往下(x,y)遞增
pStatic->GetWindowRect(&rct);//抓出pStatic這個物件在畫面上的範圍
CBrush brs;//定義筆刷使用類別
//建立一個筆刷 裡頭RGB數值 請自行參閱色碼表
brs.CreateSolidBrush(RGB(255, 255, 255));

CRect picrct;//定義一個名為picrct的矩形座標系 讓它的範圍與IDC_SHOW這個picture control大小相同
picrct.top = 0;
picrct.left = 0;
picrct.bottom = rct.Height();
picrct.right = rct.Width();
pDC->FillRect(&picrct, &brs);//畫上顏色

實際應用上你可以放個button 按下時執行以上動作顯示顏色...etc ,up to U




2012年3月8日 星期四

Windows 8 introduction


Ribbon UI
更聰明的檔案管理功能
支援ISOVHD格式
導入Hyper-V虛擬化功能
原生支援USB 3.0
METRO UI
Windows To Go

[技巧]在eclipse上開啟Logcat View

開發android app 通常都會使用eclipse來做為工具,

在開發過程中常需要觀看訊息輸出 這時就需要開啟LogCat來達成這個目的

step1. 選擇    [window]->[show view]->[Other...]


step2. 選擇 Android中的LogCat選項


如此一來 即可在最下方的視窗中發現Logcat Tab



2012年3月2日 星期五

簡單製作bat檔

Step1.創新一個文件檔

Step2.開啟檔案並輸入以下資訊
-----------------------不包含這條線----------------------------
@Echo off
cls
echo Press any key to Start.
pause
ipconfig(由使用者輸入相關的語法,請上http://www.csie.ntu.edu.tw/~r91112/myDownload/WEB/CMD.html查詢)
pause

Step3.儲存檔案並更改副檔名,由TXT改成BAT



Step4.點擊bat檔,執行批次檔

[技巧]清除系統垃圾小工具(系統優化)

電腦用久了一定會有許多暫存檔案以及不需用到的東西佔用系統空間

現在就教大家 如何自己製作清除系統垃圾的小工具

首先 打開 windows的記事本

將下面這段文字複製到裡頭


@echo off
Echo 正在清除系統垃圾文件,請稍等......
Del /f /s /q %systemdrive%\*.tmp
Del /f /s /q %systemdrive%\*._mp
Del /f /s /q %systemdrive%\*.log
Del /f /s /q %systemdrive%\*.gid
Del /f /s /q %systemdrive%\*.chk
Del /f /s /q %systemdrive%\*.old
Del /f /s /q %systemdrive%\recycled\*.*
Del /f /s /q %windir%\*.bak
Del /f /s /q %windir%\prefetch\*.*
Rd /s /q %windir%\temp & MD %windir%\temp
Del /f /q %userprofile%\cookies\*.*
Del /f /q %userprofile%\recent\*.*
Del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*"
Del /f /s /q "%userprofile%\Local Settings\Temp\*.*"
Del /f /s /q "%userprofile%\recent\*.*"
Echo 清除系統垃圾完成!
Echo. & pause

再將它存為副檔名為bat的windows批次處理檔即可

在這邊介紹一下大概的運作


%systemdrive%表示你安裝系統的磁碟機,比如說你裝在C:\,那%systemdrive%="C:"。

%windir%表示你安裝Windows的資料夾,比如說你裝在C:\Windows,

那%windir%="C:\Windows"。

%userprofile%表示使用者的資料夾,比如說你的帳號叫Alan,那設%userprofile%="C:\Documents and Settings\Alan"。
%systemroot%預設等同於%windir%

%AllUsersProfile%表示所有使用者的共用資料夾,預設%AllUsersProfile%="C:\Documents and Settings\All Users"。


刪除:del
/f 強制刪除
/s 包括子目錄
/q 安靜模式,也就是在刪除時不顯示訊息
刪除目錄:rd (rd只能用來移除空目錄,只要目錄中還有檔案,就沒辦法用rd來刪除!)

綜合以上就是清除完系統暫存文件後,再清除使用者所製造的暫存文件。

希望對大家有幫助