Witam.
Mam taki problem z odświeżaniem w komponencie Image, włączyłem DoubleBuffered i gdy Image jest bezpośrednio na formularzu to jest OK, ale gdy Image jest w komponencie ScrollBox to obraz jest wyświetlany tak, jakby DoubleBuffered był wyłączony.
Tutaj jest exe:
http://www.extradomena.pl/pliki/builder.exe
Źródło:
void __fastcall TForm1::FormCreate(TObject *Sender)
{
DoubleBuffered = true;
Image1->Picture->Bitmap->Width = Image1->Width;
Image1->Picture->Bitmap->Height = Image1->Height;
Image2->Picture->Bitmap->Width = Image2->Width;
Image2->Picture->Bitmap->Height = Image2->Height;
Image1->Picture->Bitmap->Canvas->Brush->Color = clRed;
Image2->Picture->Bitmap->Canvas->Brush->Color = clRed;
Image1->Picture->Bitmap->Canvas->Rectangle(0,0,Image1->Width,Image1->Height);
Image2->Picture->Bitmap->Canvas->Rectangle(0,0,Image2->Width,Image2->Height);
}
//---------------------------------------------------------------------------
// bezposrednio w Form1
void __fastcall TForm1::Image2MouseMove(TObject *Sender, TShiftState Shift,
int X, int Y)
{
if ( Shift.Contains(ssLeft) )
{
Image2->Picture->Bitmap->Canvas->Rectangle(0,0,Image2->Width,Image2->Height);
Image2->Picture->Bitmap->Canvas->Ellipse(X-20,Y-20,X+20,Y+20);
}
}
//---------------------------------------------------------------------------
// w ScrollBox'ie i tutaj jest zle odswiezanie
void __fastcall TForm1::Image1MouseMove(TObject *Sender, TShiftState Shift,
int X, int Y)
{
if ( Shift.Contains(ssLeft) )
{
Image1->Picture->Bitmap->Canvas->Rectangle(0,0,Image1->Width,Image1->Height);
Image1->Picture->Bitmap->Canvas->Ellipse(X-20,Y-20,X+20,Y+20);
}
}
Z góry dziękuję za odpowiedź.
Pozdrawiam.