找回密码
 立即注册
搜索
查看: 455|回复: 0

在 C++ Builder 中使位图背景透明的方法

[复制链接]

266

主题

0

回帖

1119

积分

管理员

积分
1119
发表于 2023-12-26 00:05:02 | 显示全部楼层 |阅读模式

本文提供一种使用 Graphics::TBitmap 的方法使位图背景透明化,直接上代码:

Graphics::TBitmap *bm = new Graphics::TBitmap;
bm->Transparent = true;
bm->TransparentMode = tmFixed;
bm->TransparentColor = clWhite;
MForm->ImageList1->GetBitmap(2, bm);
this->Canvas->Draw(10, 100, bm);
delete bm;

TransparentMode:设置透明模式
tmAuto:使用图片左下角像素的颜色作为透明颜色
tmFixed:使用 TransparentColor 属性指定的颜色作为透明颜色


您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|棱讯科技 ( 粤ICP备2024228160号-2|粤公网安备44030002003510号 )

GMT+8, 2024-7-27 18:33 , Processed in 0.013888 second(s), 3 queries , Redis On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表