[問題] VC++ WinForm開關按鈕
IDE:Visual C++ 2008
原始檔:http://www.badongo.com/file/19519262 VC++ 專案檔
問題檔案名稱:Form1.h
貪食蛇 簡化簡化版
內容描述:
bool isStart;//全域變數
Form1 //成員內容
panel1//面板
pictureBox1//儲存圖案的元件
botton1//Text預設值"Start"
//滑鼠事件處理
botton1_Click
(isStart) ? start() : stop();
<----------流程----------->
1.點選botton1"Start"
1.1 呼叫start()
1.2 isStart=true
1.3 botton1.Text->"Stop"
1.4 while(isStart)
1.5 pictureBox會在panel1上移動
2.點選botton1 "Stop"
2.1 isStart=false
2.2 botton1.Text->"Start"
2.3 while(isStart)
2.4 pictureBox會在panel1上停止
案例:
case1: 1.1->1.2->1.3->1.4->1.5
1.3未改變,且Form1無法回應(圖案持續移動)
case2: 1.1->1.2->1.3->2.1->2.2
1.4沒有執行,則botton.Text可以正常改變
程式段落:
void start(){
isStart=true;
this->button1->Text = L"Stop";
//問題區段
/*while(isStart ){
int num = getche();
switch(num){
default:
x--;
this->pictureBox1->Location = System::Drawing::Point(x, y);
Sleep(300);
break;
}
} //結束while *
}
void stop(){
isStart=false;
this->button1->Text = L"Start";
}
額外問題
在VC++的專案檔中 有個跟專案名稱相同的.ncb
.ncb (N)o (C)ompile (B)rowser. 儲存跟 ClassView, autoCompletion 等有關的質料.
可刪, 在開啟 workspace 時會從新產生.
檔案大的嚇人,vc++能夠設定幫它自動減肥或是清除嗎?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 123.240.192.25
推
01/04 20:02, , 1F
01/04 20:02, 1F
※ 編輯: VVll 來自: 123.240.192.25 (01/04 20:50)
推
01/05 21:33, , 2F
01/05 21:33, 2F
→
01/06 11:41, , 3F
01/06 11:41, 3F
討論串 (同標題文章)
完整討論串 (本文為第 1 之 2 篇):
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章