Probleme de transparence de Form
Bonjours
J'ai un petit probleme, je pose deux TImage transparent sur une Form, la Form1 a les proprietes
Citation:
AlphaBlend = false
AlphaBlendValue = 255
Color = clWhite
TransparentColor = false
TransparentColorValue = clBlack
Le fait de donner les proprietes transparent aux TImage rend aussi la Form1 transparente et le fond d'ecran apparait lors des traces sur les TImage ce qui est tres genant, y a t'il une commande que je n'ai pas activee?
J'ai du pour avoir un comportement satisfaisant placer une Form2 avec la propriete Color = clBlack
Voici le code de teste
J'utilise BCB6 et Window7
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
#include "Unit2.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
TransparentColor = clWhite;
Image1->Canvas->Brush->Color = clWhite; //TransparentColor;
Image1->Transparent = true;
Image1->Canvas->Pen->Width = 1;
Image1->Canvas->Pen->Color = clBlack;
Image1->Canvas->FillRect(Rect(0,0,Image1->Width,Image1->Height));
Image1->Canvas->MoveTo(0,0);
Image1->Canvas->LineTo(100,100);
Image2->Canvas->Brush->Color = clWhite; //TransparentColor;
Image2->Transparent = true;
Image2->Canvas->FillRect(Rect(0,0,Image2->Width,Image2->Height));
Image2->Canvas->MoveTo(0,20);
Image2->Canvas->LineTo(200,300);
Form1->BringToFront();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormPaint(TObject *Sender)
{
Form2->Show();
Form2->SendToBack();
}
//--------------------------------------------------------------------------- |