Re: [問題] 關於MFC~ button和Listbox的問題
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
推
11/21 01:48, , 1F
11/21 01:48, 1F
→
11/21 01:58, , 2F
11/21 01:58, 2F
討論串 (同標題文章)
完整討論串 (本文為第 2 之 2 篇):
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章