|
다름이 아니라 계산기비슷한 것을 짜보려고 합니다.그림은 다음과 같습니다.
edit 창 1와2에 수치를 넣고 옆에 +버튼을 누르면 값이 산출되는 것을 하려 합니다 ..
소스는 다음과 같이 했습니다...솔직히 아직 개념도 잘 정리가 안되서 ...여기저기 책에서 비슷한것으로 붙였습니다.
조언좀 부탁드립니다.
#include <vcl.h>
#pragma hdrstop
#include "edical.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Edit1KeyPress(TObject *Sender, char &Key)
{
if((Key >=48&&Key<=57)||(Key==8)){
}
else{
Key=0;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Edit2KeyPress(TObject *Sender, char &Key)
{
if((Key >=48&&Key<=57)||(Key==8)){
}
else{
Key=0;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
return (Edit1+Edit2);
}
//---------------------------------------------------------------------------
|