在OnPaint
的TForm
事件,我要画的是不包括背景或其他喷漆的对象,因为他们有透明部分的位图。
如果我在一个图像绘制的图像,它的工作原理。
但是,当我在窗体的Canvas
画,这是行不通的:形象,这应该是透明的,白色部分由白色方形彩壳画布的其他对象。
Canvas->CopyMode = cmMergePaint ;
Graphics::TBitmap * Image=new Graphics::TBitmap();
Image->Transparent = true;
MainForm->Images->GetBitmap(14, Image);
Canvas->Draw(10,10,Image;
MainForm->Images->GetBitmap(0, Image);
Canvas->Draw(15,15,Image);
更新
当我使用MainForm->Images->Draw(Image->Canvas...)
的形象画,我得到什么透明的正方形内,我可以在其他组件移动。
当我画使用qazxsw POI,我得到的表上正确扩张的图象,但没有透明胶片即它的白色部分覆盖其它组件。
虽然qazxsw POI做这项工作,我需要舒展它取决于大小可变的这个组件。
MainForm->Images->GetBitmap(ImgIndex[HisType]+Rotation, Image)
使用MainForm->Images->Draw(Canvas, X, Y, ImgIndex[HisType]+Rotation, dsTransparent, itImage);
代替,让TRect DstRect(X,Y, X+32 + ( 1 - Rotation ) * 32 * Size, Y+32 + Rotation * 32 * Size);
Graphics::TBitmap * Image=new Graphics::TBitmap();
Image->Transparent=true;
//MainForm->Images->GetBitmap(ImgIndex[HisType]+Rotation, Image);
MainForm->Images->Draw(Image->Canvas, 0, 0, ImgIndex[HisType]+Rotation, dsTransparent, itImage);
Canvas->StretchDraw(DstRect, Image);
delete Image;
//MainForm->Images->Draw(Canvas, X, Y, ImgIndex[HisType]+Rotation, dsTransparent, itImage);
处理绘图为您提供:
Images->Draw()
找到了解决办法,谢谢雷米。我们必须先填写新创建位图用一种颜色,而不是让它以透明的工作空...
TImageList