Hi,
High just joined as need to create a GUI using borland c++ which have not used before.
Have created a MDI child to display an image which I need to be able to draw a line on and place an elipse, can anyone help please as my C++ is a bit rusty....thanks++
############## Main ###############
#include <vcl.h>
#pragma hdrstop
#include "PVMain.h"
#include "PVChild.h"
#include "About.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TMainForm *MainForm;
//---------------------------------------------------------------------------
__fastcall TMainForm::TMainForm(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::Open1Click(TObject *Sender)
{
if (OpenDialog->Execute())
{
TChild* child = new TChild(this);
child->Image->Picture->LoadFromFile(OpenDialog->FileName);
child->ClientWidth = child->Image->Picture->Width;
child->ClientHeight = child->Image->Picture->Height;
child->Caption = ExtractFileName(OpenDialog->FileName);
child->Show();
}
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::Save1Click(TObject *Sender)
{
TChild*child = dynamic_cast<TChild*>(ActiveMDIChild);
if (!child) return;
if (SaveDialog->Execute())
{
child->Image->Picture->SaveToFile(SaveDialog->FileName);
}
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::Tile1Click(TObject *Sender)
{
Tile();
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::Cascade1Click(TObject *Sender)
{
Cascade();
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::ArrangeAll1Click(TObject *Sender)
{
ArrangeIcons();
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::About1Click(TObject *Sender)
{
AboutBox->ShowModal();
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::FormCreate(TObject *Sender)
{
}
//---------------------------------------------------------------------------
################# Child ####################
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "PVChild.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TChild *Child;
//---------------------------------------------------------------------------
__fastcall TChild::TChild(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TChild::FormClose(TObject *Sender, TCloseAction &Action)
{
Action = caFree;
}
//---------------------------------------------------------------------------
void __fastcall TChild::ImageClick(TObject *Sender)
{
}
//---------------------------------------------------------------------------
High just joined as need to create a GUI using borland c++ which have not used before.
Have created a MDI child to display an image which I need to be able to draw a line on and place an elipse, can anyone help please as my C++ is a bit rusty....thanks++
############## Main ###############
#include <vcl.h>
#pragma hdrstop
#include "PVMain.h"
#include "PVChild.h"
#include "About.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TMainForm *MainForm;
//---------------------------------------------------------------------------
__fastcall TMainForm::TMainForm(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::Open1Click(TObject *Sender)
{
if (OpenDialog->Execute())
{
TChild* child = new TChild(this);
child->Image->Picture->LoadFromFile(OpenDialog->FileName);
child->ClientWidth = child->Image->Picture->Width;
child->ClientHeight = child->Image->Picture->Height;
child->Caption = ExtractFileName(OpenDialog->FileName);
child->Show();
}
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::Save1Click(TObject *Sender)
{
TChild*child = dynamic_cast<TChild*>(ActiveMDIChild);
if (!child) return;
if (SaveDialog->Execute())
{
child->Image->Picture->SaveToFile(SaveDialog->FileName);
}
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::Tile1Click(TObject *Sender)
{
Tile();
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::Cascade1Click(TObject *Sender)
{
Cascade();
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::ArrangeAll1Click(TObject *Sender)
{
ArrangeIcons();
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::About1Click(TObject *Sender)
{
AboutBox->ShowModal();
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::FormCreate(TObject *Sender)
{
}
//---------------------------------------------------------------------------
################# Child ####################
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "PVChild.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TChild *Child;
//---------------------------------------------------------------------------
__fastcall TChild::TChild(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TChild::FormClose(TObject *Sender, TCloseAction &Action)
{
Action = caFree;
}
//---------------------------------------------------------------------------
void __fastcall TChild::ImageClick(TObject *Sender)
{
}
//---------------------------------------------------------------------------