Hi,
I solved a flickering problem by writing a piece of code like this..
.........................................
//--------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Main.h"
//--------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//--------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner): TForm(Owner)
{
pBitmap=new Graphics::TBitmap;
pBitmap->Width=Form1->Width; pBitmap->Height=Form1->Height;
sk.pCanvas=pBitmap->Canvas;
//pBitmap->Canvas->Rectangle(0,0,ClientWidth, ClientHeight);
//pBitmap->Canvas=sk.pCanvas;
}
//--------------------------------------------------------------------
void __fastcall TForm1::FormPaint(TObject *Sender)
{
//pBitmap->Canvas->Rectangle(0,0,ClientWidth, ClientHeight);
sk.Clear();
fb.Config();
fb.Draw(sk);
TRect Rect(0, 0, Form1->Width, Form1->Height);
Canvas->CopyRect(Rect, pBitmap->Canvas, Rect);
//Canvas->DrawFocusRect(Rect);//(0, 0, pBitmap);
}
//--------------------------------------------------------------------
void __fastcall TForm1::FormShow(TObject *Sender)
{
//
}
//--------------------------------------------------------------------
void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
sc.curTheta+=0.05;
fb.curTheta+=0.03;
FormPaint(NULL);
}
//--------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Timer1->Enabled=!Timer1->Enabled;
}
//--------------------------------------------------------------------
void __fastcall TForm1::Clear1Click(TObject *Sender)
{
//sc.Tc.Clear();
fb.Tc.Clear();
FormPaint(NULL);
}
//--------------------------------------------------------------------
void __fastcall TForm1::FourBarLink1Click(TObject *Sender)
{
//
}
//--------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////
But unfortunately when I run the program I have several problems by
Drawing lines in my program...
This is a program for simulating mechanism and it should write
Several lines in each slide...but when I solve the flickering problem I have problem with drawing line that should be written...I mean it Doesn't clear previous line.
This program has several classes. If you couldn't understand my Problem I can give you the source code...
Thank you
I solved a flickering problem by writing a piece of code like this..
.........................................
//--------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Main.h"
//--------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//--------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner): TForm(Owner)
{
pBitmap=new Graphics::TBitmap;
pBitmap->Width=Form1->Width; pBitmap->Height=Form1->Height;
sk.pCanvas=pBitmap->Canvas;
//pBitmap->Canvas->Rectangle(0,0,ClientWidth, ClientHeight);
//pBitmap->Canvas=sk.pCanvas;
}
//--------------------------------------------------------------------
void __fastcall TForm1::FormPaint(TObject *Sender)
{
//pBitmap->Canvas->Rectangle(0,0,ClientWidth, ClientHeight);
sk.Clear();
fb.Config();
fb.Draw(sk);
TRect Rect(0, 0, Form1->Width, Form1->Height);
Canvas->CopyRect(Rect, pBitmap->Canvas, Rect);
//Canvas->DrawFocusRect(Rect);//(0, 0, pBitmap);
}
//--------------------------------------------------------------------
void __fastcall TForm1::FormShow(TObject *Sender)
{
//
}
//--------------------------------------------------------------------
void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
sc.curTheta+=0.05;
fb.curTheta+=0.03;
FormPaint(NULL);
}
//--------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Timer1->Enabled=!Timer1->Enabled;
}
//--------------------------------------------------------------------
void __fastcall TForm1::Clear1Click(TObject *Sender)
{
//sc.Tc.Clear();
fb.Tc.Clear();
FormPaint(NULL);
}
//--------------------------------------------------------------------
void __fastcall TForm1::FourBarLink1Click(TObject *Sender)
{
//
}
//--------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////
But unfortunately when I run the program I have several problems by
Drawing lines in my program...
This is a program for simulating mechanism and it should write
Several lines in each slide...but when I solve the flickering problem I have problem with drawing line that should be written...I mean it Doesn't clear previous line.
This program has several classes. If you couldn't understand my Problem I can give you the source code...
Thank you