Hi,
Thank you for your answer but that didn't resolve yet my problem. I want to print from a TeePreviewPanel and not from a ChartPreviewer, I try to be more explicit. Here is my code:
unit1.h
//---------------------------------------------------------------------------
#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include "TeePreviewPanel.hpp"
#include <Buttons.hpp>
#include <Chart.hpp>
#include <DBChart.hpp>
#include <ExtCtrls.hpp>
#include <Series.hpp>
#include <TeEngine.hpp>
#include <TeeProcs.hpp>
#include "TeeTools.hpp"
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
TDBChart *DBChart1;
TDBChart *DBChart2;
TDBChart *DBChart3;
TLineSeries *Series1;
TLineSeries *Series2;
TLineSeries *Series3;
TTeePreviewPanel *TeePreviewPanel1;
TSpeedButton *SpeedButton1;
TAnnotationTool *ChartTool1;
TAnnotationTool *ChartTool2;
TAnnotationTool *ChartTool3;
TLabel *Label1;
void __fastcall SpeedButton1Click(TObject *Sender);
private: // User declarations
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
unit1.cpp
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "TeePreviewPanel"
#pragma link "TeeTools"
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
Series1->FillSampleValues(8);
Series2->FillSampleValues(8);
Series3->FillSampleValues(8);
DBChart1->PrintProportional = false;
DBChart2->PrintProportional = false;
DBChart3->PrintProportional = false;
DBChart1->PrintMargins = Rect(2,2,2,70);
DBChart2->PrintMargins = Rect(2,35,2,35);
DBChart3->PrintMargins = Rect(2,65,2,2);
DBChart1->Legend->CustomPosition = true;
DBChart1->Legend->PositionUnits =muPercent;
DBChart1->Legend->LeftPercent = 30;
DBChart1->Legend->TopPercent = 20;
DBChart2->Legend->CustomPosition = true;
DBChart2->Legend->PositionUnits =muPercent;
DBChart2->Legend->LeftPercent = 40;
DBChart2->Legend->TopPercent = 30;
DBChart3->Legend->CustomPosition = true;
DBChart3->Legend->PositionUnits =muPercent;
DBChart3->Legend->LeftPercent = 70;
DBChart3->Legend->TopPercent = 70;
ChartTool1->Shape->CustomPosition = true;
ChartTool1->PositionUnits = muPercent;
ChartTool1->Shape->Left = 30;
ChartTool1->Shape->Top = 65;
ChartTool2->Shape->CustomPosition = true;
ChartTool2->PositionUnits = muPercent;
ChartTool2->Shape->Left = 50;
ChartTool2->Shape->Top = 65;
ChartTool3->Shape->CustomPosition = true;
ChartTool3->PositionUnits = muPercent;
ChartTool3->Shape->Left = 70;
ChartTool3->Shape->Top = 45;
// add to preview
TeePreviewPanel1->Panels->Add(DBChart1);
TeePreviewPanel1->Panels->Add(DBChart2);
TeePreviewPanel1->Panels->Add(DBChart3);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::SpeedButton1Click(TObject *Sender)
{
TeePreviewPanel1->Print();
}
//---------------------------------------------------------------------------
Here are my outputs:
Please give me a solution for my example.
And, at the end, another question: how can I select a chart from TeePreviewPanel in order to change at runtime the PrintMargins with the mouse? I want to see all the charts on the panel when I change the PrintMargins.
Thank you for your time
My best regards
Mihael Avram