作者makiyolove (暴力熊)
看板C_and_CPP
標題Re: [問題] 關於MFC~ button和Listbox的問題
時間Sat Nov 21 01:22:26 2009
Rad Studio 2010 測試OK
記得要加上 Application->ProcessMessages();
不然程式會卡死,button1會不給你按
看不出來你的目的是什麼...該不會是學校作業吧=_=
題外話,最近在學C#...
我衷心認為對設計win app來說c++ builder真的比VS好用多了..
好想把大家都拉來寫c++ builder~~~~
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
bool tmp;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
tmp=false;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
if(!tmp)
{
tmp=true;
while(tmp)
{
ListBox1->Items->Add("#");
ListBox1->ItemIndex=ListBox1->Count-1;
Application->ProcessMessages();
if(!tmp) break;
}
}
else
{
tmp=false;
}
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.39.168.235
1F:推 kevinimpreza:感謝你的幫忙 這個問題我研究了三個星期之久> <" 11/21 01:48
2F:→ makiyolove:你需要多建立一點程式設計邏輯,多做題目~歡迎加入bcb 11/21 01:58