Программирование для Windows на Borland C++

       

Исходный текст приложения


#include <owl\applicat.h>

int OwlMain(int, char* [])

{

TApplication app("Hello, Windows !");

return app.Run();

}


#include <owl\applicat.h>

int OwlMain(int, char* [])

{

TApplication *app;

app=new TApplication(" Hello Windows !");

return app->Run();

}




#include <owl\applicat.h>

int OwlMain(int, char* [])

{

return TApplication(" Hello Windows !").Run();

}




#include <owl\applicat.h>

#include <owl\framewin.h>

#include <owl\dc.h>

class TMyWin : public TFrameWindow

{

public:

TPoint pn,pk;

TMyWin() : TFrameWindow(0,"The Paint function")

{

pn.x=100;

pn.y=50;

pk.x=300;

pk.y=200;

}

void Paint(TDC&,BOOL,TRect&);

};

void TMyWin::Paint(TDC &dc,BOOL,TRect&)

{

TColor color(TColor::LtBlue);

TPen pen1(color);

dc.SelectObject(pen1);

dc.Rectangle(pn,pk);

TPen pen2(TColor::LtGreen);

dc.SelectObject(pen2);

dc.Ellipse(pn,pk);

}

class TMyApp : public TApplication

{

public:

TMyApp():TApplication()

{}

void InitMainWindow()

{

MainWindow=new TMyWin();

}

};

int OwlMain(int, char *[])

{

TMyApp app;

return app.Run();

}

 




#include <owl\applicat.h>

#include <owl\framewin.h>

#include <owl\dc.h>

#pragma hdrstop

#include "lab3а.rh"

class TMyWin : public TFrameWindow

{

public:

TPoint pn,pk;

TMyWin() : TFrameWindow(0,"The Paint function")

{

pn.x=100;

pn.y=50;

pk.x=300;

pk.y=200;

}

protected:

void Paint(TDC&,BOOL,TRect&);

void CmLarge();

void CmSmall();

DECLARE_RESPONSE_TABLE(TMyWin);

};

DEFINE_RESPONSE_TABLE1(TMyWin,TFrameWindow)

EV_COMMAND(CM_SIZE_LARGE,CmLarge),

EV_COMMAND(CM_SIZE_SMALL,CmSmall),

END_RESPONSE_TABLE;

void TMyWin::Paint(TDC &dc,BOOL,TRect&)

{

TColor color(TColor::LtBlue);

TPen pen1(color);

dc.SelectObject(pen1);

dc.Rectangle(pn,pk);

TPen pen2(TColor::LtGreen);

dc.SelectObject(pen2);

dc.Ellipse(pn,pk);

}

void TMyWin::CmLarge()

{

pk.x=500;

pk.y=400;

Invalidate();

}

void TMyWin::CmSmall()

{

pk.x=150;

pk.y=100;

Invalidate();

}

class TMyApp : public TApplication

{

public:

TMyApp():TApplication()

{}

void InitMainWindow()

{

MainWindow=new TMyWin();

MainWindow->AssignMenu(MENU_1);

}

};

int OwlMain(int, char *[])

{

TMyApp app;

return app.Run();

}




#include <owl\applicat.h>

#include <owl\framewin.h>

#include <owl\edit.h>

#include <owl\button.h>

#include <owl\dc.h>

#define ID_ONELINER 150

#define CM_BUTTON 160

#define TEXTLEN 10

class TMyWin: public TFrameWindow

{

TEdit *oneLiner;

char txt[TEXTLEN];

public:

TMyWin(): TFrameWindow(0,"the TEdit object")

{

- oneLiner=new TEdit(this,ID_ONELINER,"Input one line",10,10,100,30,TEXTLEN,FALSE);

- new TButton(this,CM_BUTTON,"Update",10,100,70,25);

- txt[0]='\0';

}

protected:

void CmButton();

void Paint(TDC&,BOOL,TRect&);

DECLARE_RESPONSE_TABLE(TMyWin);

};

DEFINE_RESPONSE_TABLE1(TMyWin,TFrameWindow)

EV_COMMAND(CM_BUTTON,CmButton),

END_RESPONSE_TABLE;

void TMyWin::CmButton()

{

oneLiner->GetLine(txt,TEXTLEN,0);

Invalidate();

//UpdateWindow();

}

void TMyWin::Paint(TDC& dc,BOOL,TRect&)

{

- for (int i=1;i<=2;i++)

- dc.TextOut(150,50+i*20,txt);

}

class TMyApp:public TApplication

{

public:

TMyApp(): TApplication(){};

void InitMainWindow()

- {

- MainWindow=new TMyWin();

- }

};

int OwlMain(int,char *[])

{

return TMyApp().Run();

}



Содержание раздела