Скачиваний:
18
Добавлен:
01.05.2014
Размер:
1.6 Кб
Скачать
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
#include "Unit2.h"
#include "ChildWin.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm2 *Form2;
//---------------------------------------------------------------------------
__fastcall TForm2::TForm2(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TForm2::FormCreate(TObject *Sender)
{
	TfrmMDIChild *frm = dynamic_cast<TfrmMDIChild*>(Owner);
	CheckBox1->Checked = frm->isDrawLines;
    Edit1->Text = IntToStr(frm->Panel1->Width);
    Edit2->Text = IntToStr(frm->Panel1->Height);
}
//---------------------------------------------------------------------------

void __fastcall TForm2::BitBtn1Click(TObject *Sender)
{
	TfrmMDIChild *frm = dynamic_cast<TfrmMDIChild*>(Owner);
	frm->isDrawLines = CheckBox1->Checked;
    try {
    	int w= StrToInt(Edit1->Text);
        int h = StrToInt(Edit2->Text);

        if (w<250 || w>2000) throw Exception("Error");
        if (h<250 || h>2000) throw Exception("Error");

        frm->pWidth = w;
        frm->pHeight= h;
	    frm->Panel1->Width = getZoomCoord(w, frm->zoom);
    	frm->Panel1->Height = getZoomCoord(h, frm->zoom);
    }
    catch(...) { ShowMessage("Неправильный ввод!"); }

    frm->Panel1->Invalidate();
}
//---------------------------------------------------------------------------
Соседние файлы в папке Sources