TeeChart 6.01 for Borland C++ 6
Posted: Wed Jun 06, 2007 8:19 am
Is there a chance to make the chart background transparent ??
Steema Software - Customer Support Forums
http://216.92.101.67/support/
Code: Select all
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "TeeComma"
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
Chart1->Color=clNone;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Chart1BeforeDrawChart(TObject *Sender)
{
Back = new Graphics::TBitmap();
Back->Width = Chart1->Width;
Back->Height = Chart1->Height;
Back->Canvas->CopyRect(Chart1->ClientRect,Canvas,Chart1->BoundsRect);
if (Chart1->Color==clNone) Chart1->Canvas->Draw(0,0,Back);
}
//---------------------------------------------------------------------------
Code: Select all
//---------------------------------------------------------------------------
#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include "TeeComma.hpp"
#include <Chart.hpp>
#include <ExtCtrls.hpp>
#include <Series.hpp>
#include <TeEngine.hpp>
#include <TeeProcs.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
TChart *Chart1;
TTeeCommander *TeeCommander1;
TLineSeries *Series1;
void __fastcall FormCreate(TObject *Sender);
void __fastcall Chart1BeforeDrawChart(TObject *Sender);
private: // User declarations
Graphics::TBitmap *Back;
TTeeBlend *Blend;
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
Code: Select all
void __fastcall TForm1::Chart1AfterDraw(TObject *Sender)
{
int transparency;
TTeeBlend *blend;
TRect r;
transparency=100;
r.Left = 0;
r.Top =0;
r.Bottom = Chart1->Height;
r.Right = Chart1->Width;
blend = Chart1->Canvas->BeginBlending(r, transparency);
Chart1->Canvas->Pen->Color = this->Color;
Chart1->Canvas->Brush->Color = this->Color;
Chart1->Canvas->Rectangle(r);
Chart1->Canvas->EndBlending(blend);
}
Code: Select all
void __fastcall TForm1::Chart1BeforeDrawChart(TObject *Sender)
{
if (Back==NULL)
{
Back = new Graphics::TBitmap();
Back->Width = Chart1->Width;
Back->Height = Chart1->Height;
Back->Canvas->CopyRect(Chart1->ClientRect,Canvas,Chart1->BoundsRect);
}
if (Chart1->Color==clNone) Chart1->Canvas->Draw(0,0,Back);
}