Re: [問題] 關於MFC~ button和Listbox的問題

看板C_and_CPP (C/C++)作者 (暴力熊)時間16年前 (2009/11/21 01:22), 編輯推噓1(101)
留言2則, 2人參與, 最新討論串2/2 (看更多)
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
你需要多建立一點程式設計邏輯,多做題目~歡迎加入bcb
11/21 01:58, 2F
文章代碼(AID): #1B1j1Lur (C_and_CPP)
文章代碼(AID): #1B1j1Lur (C_and_CPP)