#include "WinTmpl.h"
#include "WinTmpl.cpp"
/* Ex1.cpp: InputBoxと ShowMessageのテスト */

// コンパイルするときは、user32と gdi32をリンクしておく 
// BCC32の場合:      bcc32 -W Ex1.cpp
//	または:	     bcc32 Ex1.cpp -luser32 -lgdi32 		
// Cygnus GCCの場合: g++ Ex1.cpp -mwindows -mno-cygwin
//	     または: g++ Ex1.cpp -luser32 -lgdi32

/* 大域変数の宣言はこの辺り */

TForm::TForm() {
    /* Formのサイズ・色はここで変更する */
    Width =  640;
    Height = 600;

    Color=clWhite;
}

void TForm::FormCreate(TObject* sender) {
    /* Formのサイズはここで変更する */
 
    /* Timerもここでセットしておく */
    // Timer->SetInterval(200);
    // Timer->SetEnabled(true);
}

void TForm::FormMouseDown(TObject* sender, TMouseButton which,
			  TShiftState shift, int x, int y) {

    AnsiString str;
    int n, r=1;	
    str = InputBox("入力", "あなたのすきな数字は?", "0"); 
//    str = InputBox("Input", "What?", "0");
    n = str.ToInt();
    while(n>1) {
      r*=n;
      n--;
    }
    ShowMessage("その階乗は " + AnsiString(r) + "です。");
}

void TForm::FormKeyDown(TObject* sender, WORD key, TShiftState shift) {
}

void TForm::TimerTimer(TObject* sender) {
}

void TForm::FormPaint(TObject* sender) {
    Canvas->Pen->Color = clRed;
    Canvas->Brush->Style = bsClear;
    Canvas->Ellipse(100, 100, 500, 500);
    Canvas->Font->Color = clFuchsia;
    Canvas->Font->Size = 200;
    Canvas->TextOut(200, 200, "か");
}

