Page 1 of 1

TeePreviewPanel rectangle

Posted: Mon Jan 29, 2007 8:14 am
by 5887639
Hello,

I need some help with TeePreviewPanel component. When I put at design time such a component on a form, inside the panel of he component will be drawn a rectangle which will contain all the charts added to the component. Please let me know how could I make invisible this rectangle or at least change it color (is black by default). If I print TeePreviewPanel through metafile, this rectangle will be print on the paper around the charts and I want to make it invisible.

Another question is about a title/foot for TeePreviewPanel, has anyone a suggestion how can I implement it? I tried TeePreviewPanel->Title but I don't see it displayed on the component.

Thank you in advance.

Best regards,

Mihael Avram

Posted: Mon Jan 29, 2007 10:58 am
by yeray
Hello amih,

You can try the following code to save a metafile without paper line margins:

Code: Select all

procedure TForm1.Button1Click(Sender: TObject);
begin
  TeePreviewPanel1.Panels.Add(Chart1);
  TeePreviewPanel1.Margins.Visible := false;
  TeePreviewPanel1.SaveToMetafile('C:\temp\MyMetaFile.emf');
end;
And there's no Title nor Foot for TeePreviewPanel but you can edit Chart's ones by:

Code: Select all

Chart1.Title.Text.Clear;
Chart1.Foot.Text.Clear;
Chart1.Title.Text.Add('My Title Chart');
Chart1.Foot.Text.Add('My Foot Chart');

TeePreviewPanel rectangle

Posted: Fri Feb 09, 2007 9:30 am
by 5887639
Thank you for your support.

The line:

Code: Select all

TeePreviewPanel1.Margins.Visible := false; 
doesn't work for me. I mean when I put at design time a TeePreviewPanel component on a form without any chart added to it, there is a rectangle drawn inside the panel and I don't want to print that rectangle on the paper, or at least to change its color if it's possible. It's not about the margins of the chart too.
In order to extent the graphics printed on the paper, I used negative numbers like in this example (for portrait):

Code: Select all

TMetafile * tmpMeta = new TMetafile;
  tmpMeta = TeePreviewPanel1->TeeCreateMetafile(true,
     Rect(TeePreviewPanel1->ClientRect.Left,
     TeePreviewPanel1->ClientRect.Top,TeePreviewPanel1->ClientRect.Right,
     TeePreviewPanel1->ClientRect.Bottom));
Printer()->Canvas->StretchDraw(Rect(-50,-600,Printer()->PageWidth+600, Printer()->PageHeight+600),tmpMeta);

// and here I implemented a title for the  page:

Printer()->Canvas->Font->Assign(titleEdit->Font);
int titleLeft = (Printer()->PageWidth - Printer()->Canvas->TextWidth(titleEdit->Text)) / 2;

Printer()->Canvas->TextOut(titleLeft, 10, titleEdit->Text);


but I want to disable the print of the rectangle I mentioned above. Any solution?

My best regards
Mihael Avram

Posted: Fri Feb 09, 2007 10:28 am
by yeray
Hi amih,

Using TeeChart v7.07 the next line of code works fine for us:

Code: Select all

TeePreviewPanel1->Margins->Visible = false;
If it still doesn't solve your problem, tell us what version are you using and we'll look for another solutions.