Eis o código da Unit1.h



//---------------------------------------------------------------------------
#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <vcl\Classes.hpp>
#include <vcl\Controls.hpp>
#include <vcl\StdCtrls.hpp>
#include <vcl\Forms.hpp>
#include <vcl\ExtCtrls.hpp>
#include <vcl\ComCtrls.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:    // IDE-managed Components
        TButton *Button1;
        TButton *Button2;
        TLabel *Label1;
        TLabel *Label2;
        TLabel *Label3;
        TLabel *Label4;
        TLabel *Label5;
        TImage *Image1;
        TImage *Image2;
        TEdit *Edit1;
        TEdit *Edit2;
        TEdit *Edit3;
        TEdit *Edit4;
        TEdit *Edit5;
        void __fastcall Button1Click(TObject *Sender);
        
        
        void __fastcall Button2Click(TObject *Sender);
        
        
private:        // User declarations
public:         // User declarations

void __fastcall WMNCHitTest(TMessage &Msg);
BEGIN_MESSAGE_MAP
MESSAGE_HANDLER(WM_NCHITTEST, TMessage, WMNCHitTest)
END_MESSAGE_MAP(TForm)

        __fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern TForm1 *Form1;
//---------------------------------------------------------------------------
#endif





Eis o código da Unit1.cpp


//---------------------------------------------------------------------------
#include <vcl\vcl.h>
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Image1 -> Visible = true;
Image2 -> Visible = false;
Edit1 -> Visible = false;
Edit2 -> Visible = false;
Edit3 -> Visible = false;
Edit4 -> Visible = false;
Edit5 -> Visible = false;
randomize();
Label1 -> Caption = char (rand());
Label2 -> Caption = char (rand());
Label3 -> Caption = char (rand());
Label4 -> Caption = char (rand());
Label5 -> Caption = char (rand());
Edit1 -> Text = char (rand());
Edit2 -> Text = char (rand());
Edit3 -> Text = char (rand());
Edit4 -> Text = char (rand());
Edit5 -> Text = char (rand());
if ((Label1 -> Caption == Edit1 -> Text)||(Label1 -> Caption == Edit2 -> Text) ||
        (Label1 -> Caption == Edit3 -> Text)||(Label1 -> Caption == Edit4 -> Text) ||
    (Label1 -> Caption == Edit5 -> Text)||
        (Label2 -> Caption == Edit1 -> Text)||(Label2 -> Caption == Edit2 -> Text) ||
        (Label2 -> Caption == Edit3 -> Text)||(Label2 -> Caption == Edit4 -> Text) ||
    (Label2 -> Caption == Edit5 -> Text)||
    (Label3 -> Caption == Edit1 -> Text)||(Label3 -> Caption == Edit2 -> Text) ||
        (Label3 -> Caption == Edit3 -> Text)||(Label3 -> Caption == Edit4 -> Text) ||
    (Label3 -> Caption == Edit5 -> Text)||
    (Label4 -> Caption == Edit1 -> Text)||(Label4 -> Caption == Edit2 -> Text) ||
        (Label4 -> Caption == Edit3 -> Text)||(Label4 -> Caption == Edit4 -> Text) ||
    (Label4 -> Caption == Edit5 -> Text)||
    (Label5 -> Caption == Edit1 -> Text)||(Label5 -> Caption == Edit2 -> Text) ||
        (Label5 -> Caption == Edit3 -> Text)||(Label5 -> Caption == Edit4 -> Text) ||
    (Label5 -> Caption == Edit5 -> Text))
     {
        MessageBeep(0);
        Image1 -> Visible = false;
        Image2 -> Visible = true;
     }


if ((Label1 -> Caption == Edit1 -> Text)||(Label2 -> Caption == Edit1 -> Text) ||
        (Label3 -> Caption == Edit1 -> Text)||(Label4 -> Caption == Edit1 -> Text) ||
    (Label5 -> Caption == Edit1 -> Text))
    Edit1 -> Visible = true;
if ((Label1 -> Caption == Edit2 -> Text)||(Label2 -> Caption == Edit2 -> Text) ||
        (Label3 -> Caption == Edit2 -> Text)||(Label4 -> Caption == Edit2 -> Text) ||
    (Label5 -> Caption == Edit2 -> Text))
    Edit2 -> Visible = true;
if ((Label1 -> Caption == Edit3 -> Text)||(Label2 -> Caption == Edit3 -> Text) ||
        (Label3 -> Caption == Edit3 -> Text)||(Label4 -> Caption == Edit3 -> Text) ||
    (Label5 -> Caption == Edit3 -> Text))
    Edit3 -> Visible = true;
if ((Label1 -> Caption == Edit4 -> Text)||(Label2 -> Caption == Edit4 -> Text) ||
        (Label3 -> Caption == Edit4 -> Text)||(Label4 -> Caption == Edit4 -> Text) ||
    (Label5 -> Caption == Edit4 -> Text))
    Edit4 -> Visible = true;
if ((Label1 -> Caption == Edit5 -> Text)||(Label2 -> Caption == Edit5 -> Text) ||
        (Label3 -> Caption == Edit5 -> Text)||(Label4 -> Caption == Edit5 -> Text) ||
    (Label5 -> Caption == Edit5 -> Text))
    Edit5 -> Visible = true;



}
//---------------------------------------------------------------------------
void __fastcall TForm1::WMNCHitTest(TMessage &Msg)
{
TForm::Dispatch(&Msg);
if (Msg.Result == HTCLIENT) Msg.Result = HTCAPTION;
}

//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
        Close();
}
//---------------------------------------------------------------------------

Eis o Text (a título de auxílio):


object Form1: TForm1

Left = 163

Top = 131

BorderStyle = bsNone

Caption = 'Form1'

ClientHeight = 273

ClientWidth = 524

Color = clOlive

Font.Charset = DEFAULT_CHARSET

Font.Color = clWindowText

Font.Height = -11

Font.Name = 'MS Sans Serif'

Font.Style = []

PixelsPerInch = 96

TextHeight = 13

object Label1: TLabel

Left = 112

Top = 8

Width = 73

Height = 57

Alignment = taCenter

AutoSize = False

Color = clYellow

Font.Charset = ANSI_CHARSET

Font.Color = clRed

Font.Height = -27

Font.Name = 'Times New Roman'

Font.Style = [fsBold]

ParentColor = False

ParentFont = False

end

object Label2: TLabel

Left = 192

Top = 8

Width = 73

Height = 57

Alignment = taCenter

AutoSize = False

Color = clYellow

Font.Charset = ANSI_CHARSET

Font.Color = clRed

Font.Height = -27

Font.Name = 'Times New Roman'

Font.Style = [fsBold]

ParentColor = False

ParentFont = False

end

object Label3: TLabel

Left = 272

Top = 8

Width = 73

Height = 57

Alignment = taCenter

AutoSize = False

Color = clYellow

Font.Charset = ANSI_CHARSET

Font.Color = clRed

Font.Height = -27

Font.Name = 'Times New Roman'

Font.Style = [fsBold]

ParentColor = False

ParentFont = False

end

object Label4: TLabel

Left = 352

Top = 8

Width = 73

Height = 57

Alignment = taCenter

AutoSize = False

Color = clYellow

Font.Charset = ANSI_CHARSET

Font.Color = clRed

Font.Height = -27

Font.Name = 'Times New Roman'

Font.Style = [fsBold]

ParentColor = False

ParentFont = False

end

object Label5: TLabel

Left = 432

Top = 8

Width = 73

Height = 57

Alignment = taCenter

AutoSize = False

Color = clYellow

Font.Charset = ANSI_CHARSET

Font.Color = clRed

Font.Height = -27

Font.Name = 'Times New Roman'

Font.Style = [fsBold]

ParentColor = False

ParentFont = False

end

object Image1: TImage

Left = 176

Top = 136

Width = 129

Height = 129

Center = True

Picture.Data = {...}

Visible = False

end

object Image2: TImage

Left = 320

Top = 136

Width = 129

Height = 129

Center = True

Picture.Data = {...}

Visible = False

end

object Button1: TButton

Left = 8

Top = 8

Width = 75

Height = 25

Caption = 'Apostar'

TabOrder = 0

OnClick = Button1Click

end

object Button2: TButton

Left = 8

Top = 48

Width = 75

Height = 25

Caption = 'Sair'

TabOrder = 1

OnClick = Button2Click

end

object Edit1: TEdit

Left = 112

Top = 72

Width = 73

Height = 57

AutoSize = False

Font.Charset = ANSI_CHARSET

Font.Color = clRed

Font.Height = -32

Font.Name = 'Baskerville'

Font.Style = []

ParentFont = False

TabOrder = 2

Visible = False

end

object Edit2: TEdit

Left = 192

Top = 72

Width = 73

Height = 57

AutoSize = False

Font.Charset = ANSI_CHARSET

Font.Color = clRed

Font.Height = -32

Font.Name = 'Baskerville'

Font.Style = []

ParentFont = False

TabOrder = 3

Visible = False

end

object Edit3: TEdit

Left = 272

Top = 72

Width = 73

Height = 57

AutoSize = False

Font.Charset = ANSI_CHARSET

Font.Color = clRed

Font.Height = -32

Font.Name = 'Baskerville'

Font.Style = []

ParentFont = False

TabOrder = 4

Visible = False

end

object Edit4: TEdit

Left = 352

Top = 72

Width = 73

Height = 57

AutoSize = False

Font.Charset = ANSI_CHARSET

Font.Color = clRed

Font.Height = -32

Font.Name = 'Baskerville'

Font.Style = []

ParentFont = False

TabOrder = 5

Visible = False

end

object Edit5: TEdit

Left = 432

Top = 72

Width = 73

Height = 57

AutoSize = False

Font.Charset = ANSI_CHARSET

Font.Color = clRed

Font.Height = -32

Font.Name = 'Baskerville'

Font.Style = []

ParentFont = False

TabOrder = 6

Visible = False

end

end


voltar