Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Implementing Tcanvas on MDIChild

Status
Not open for further replies.

talladam

Technical User
Feb 3, 2004
2
0
0
GB
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 &quot;PVMain.h&quot;
#include &quot;PVChild.h&quot;
#include &quot;About.h&quot;
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource &quot;*.dfm&quot;
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 &quot;PVChild.h&quot;
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource &quot;*.dfm&quot;
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)
{

}
//---------------------------------------------------------------------------

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top