TeeChart 6.01 for Borland C++ 6
TeeChart 6.01 for Borland C++ 6
Is there a chance to make the chart background transparent ??
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Peter,
You can try making chart's color being clNone and thus chart's background being transparent doing something like this:
cpp file:
header file:
You can also make the whole chart transparent doing something like this:
You can try making chart's color being clNone and thus chart's background being transparent doing something like this:
cpp file:
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
You can also make the whole chart transparent doing something like this:
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);
}
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Peter,
As a follow up to my previous reply, an enhancement for making the chart's background transparent is implementing OnBeforeDrawChart event like this:
As a follow up to my previous reply, an enhancement for making the chart's background transparent is implementing OnBeforeDrawChart event like this:
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);
}
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |