社区
C++ Builder
帖子详情
可不可以把BMP转成ICO
xiaohan13916830
2002-05-24 09:16:53
同上,;谢谢指点^_^
...全文
112
11
打赏
收藏
可不可以把BMP转成ICO
同上,;谢谢指点^_^
复制链接
扫一扫
分享
转发到动态
举报
AI
作业
写回复
配置赞助广告
用AI写文章
11 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
xiaohan13916830
2002-05-29
打赏
举报
回复
谢谢大家!
skyhole
2002-05-28
打赏
举报
回复
用ExTractIconEx() 然后查帮助文件确定参数。
如果没找到API的帮助文件,去BCB的安装盘上把WIN32那个帮助文件弄下来
Billy_Chen28
2002-05-28
打赏
举报
回复
关于ICO转换(bmp->ico):
if(hBit == NULL) // hBit is BitMap Handle
return NULL;
CBitmap oBitmap;
oBitmap.Attach(hBit);
CBitmap oBMap;
BITMAP rBitMap;
oBitmap.GetBitmap( &rBitMap );
oBMap.CreateBitmapIndirect( &rBitMap );
BYTE a[4096];
DWORD len = oBitmap.GetBitmapBits (4096,a);
for (UINT i=0; i<len; i++)
{
a[i] ^= a[i];
}
oBMap.SetBitmapBits( len, a);
HICON hIcon;
if (bTheBigIcon)
{
CImageList oImagelist;
oImagelist.Create(32, 32, TRUE, 1, 1);
oImagelist.Add(&oBitmap, &oBMap);
hIcon = oImagelist.ExtractIcon( 0 );
oImagelist.DeleteImageList();
}
else
{
CImageList oImagelist;
oImagelist.Create(16, 16, TRUE, 1, 1);
oImagelist.Add(&oBitmap, &oBMap);
hIcon = oImagelist.ExtractIcon( 0 );
oImagelist.DeleteImageList();
}
m_bIcon = false;
return hIcon;
guolinchao
2002-05-28
打赏
举报
回复
好象可以用ChangFileExt();
AnsiString __fastcall ChangeFileExt(const AnsiString FileName,const AnsiString Extension);
王集鹄
2002-05-28
打赏
举报
回复
//for Delphi
function BmpToIco(mBitmap: TBitmap; mIcon: TIcon;
mSize32: Boolean = True): Boolean;
var
vIconWidth: Integer;
vIconHeight: Integer;
vBitmapMask: TBitmap;
vBitmapColor: TBitmap;
vIconInfo: TIconInfo;
begin
Result := True;
if mSize32 then begin
vIconWidth := 32;
vIconHeight := 32;
end else begin
vIconWidth := 16;
vIconHeight := 16;
end;
vBitmapMask := TBitmap.Create;
vBitmapColor := TBitmap.Create;
try
vBitmapMask.Width := vIconWidth;
vBitmapMask.Height := vIconHeight;
vBitmapMask.Canvas.Brush.Color := clBlack;
vBitmapMask.Canvas.Rectangle(0, 0, vIconWidth, vIconHeight);
vBitmapColor.Width := vIconWidth;
vBitmapColor.Height := vIconHeight;
StretchBlt(vBitmapColor.Canvas.Handle, 0, 0, vIconWidth, vIconHeight,
mBitmap.Canvas.Handle, 0, 0, mBitmap.Width, mBitmap.Height, SRCCOPY);
vIconInfo.fIcon := True;
vIconInfo.xHotspot := 0;
vIconInfo.yHotspot := 0;
vIconInfo.hbmMask := vBitmapMask.Handle;
vIconInfo.hbmColor := vBitmapColor.Handle;
mIcon.Handle := CreateIconIndirect(vIconInfo);
except
Result := False;
end;
vBitmapMask.Free;
vBitmapColor.Free;
end; { BmpToIco }
//for Borland C++ Builder
bool BmpToIco(Graphics::TBitmap* mBitmap, TIcon* mIcon, bool mSize32 = true)
{
///////begin var
int vIconWidth;
int vIconHeight;
Graphics::TBitmap* vBitmapMask;
Graphics::TBitmap* vBitmapColor;
TIconInfo vIconInfo;
///////end var
if ((mBitmap == NULL) || (mIcon == NULL)) return false;
if (mSize32) {
vIconWidth = 32;
vIconHeight = 32;
} else {
vIconWidth = 16;
vIconHeight = 16;
};
vBitmapMask = new Graphics::TBitmap;
vBitmapColor = new Graphics::TBitmap;
try {
vBitmapMask->Width = vIconWidth;
vBitmapMask->Height = vIconHeight;
vBitmapMask->Canvas->Brush->Color = clBlack;
vBitmapMask->Canvas->Rectangle(0, 0, vIconWidth, vIconHeight);
vBitmapColor->Width = vIconWidth;
vBitmapColor->Height = vIconHeight;
StretchBlt(vBitmapColor->Canvas->Handle, 0, 0, vIconWidth, vIconHeight,
mBitmap->Canvas->Handle, 0, 0, mBitmap->Width, mBitmap->Height, SRCCOPY);
vIconInfo.fIcon = true;
vIconInfo.xHotspot = 0;
vIconInfo.yHotspot = 0;
vIconInfo.hbmMask = vBitmapMask->Handle;
vIconInfo.hbmColor = vBitmapColor->Handle;
mIcon->Handle = CreateIconIndirect(&vIconInfo);
} __finally {
delete vBitmapMask;
delete vBitmapColor;
};
return true;
} /* BmpToIco */
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
BmpToIco(Image1->Picture->Bitmap, Image2->Picture->Icon);
}
//---------------------------------------------------------------------------
王集鹄
2002-05-28
打赏
举报
回复
//for Delphi
function BmpToIco(mBitmap: TBitmap; mIcon: TIcon;
mSize32: Boolean = True): Boolean;
var
vIconWidth: Integer;
vIconHeight: Integer;
vBitmapMask: TBitmap;
vBitmapColor: TBitmap;
vIconInfo: TIconInfo;
begin
Result := True;
if mSize32 then begin
vIconWidth := 32;
vIconHeight := 32;
end else begin
vIconWidth := 16;
vIconHeight := 16;
end;
vBitmapMask := TBitmap.Create;
vBitmapColor := TBitmap.Create;
try
vBitmapMask.Width := vIconWidth;
vBitmapMask.Height := vIconHeight;
vBitmapMask.Canvas.Brush.Color := clBlack;
vBitmapMask.Canvas.Rectangle(0, 0, vIconWidth, vIconHeight);
vBitmapColor.Width := vIconWidth;
vBitmapColor.Height := vIconHeight;
StretchBlt(vBitmapColor.Canvas.Handle, 0, 0, vIconWidth, vIconHeight,
mBitmap.Canvas.Handle, 0, 0, mBitmap.Width, mBitmap.Height, SRCCOPY);
vIconInfo.fIcon := True;
vIconInfo.xHotspot := 0;
vIconInfo.yHotspot := 0;
vIconInfo.hbmMask := vBitmapMask.Handle;
vIconInfo.hbmColor := vBitmapColor.Handle;
mIcon.Handle := CreateIconIndirect(vIconInfo);
except
Result := False;
end;
vBitmapMask.Free;
vBitmapColor.Free;
end; { BmpToIco }
//for Borland C++ Builder
bool BmpToIco(Graphics::TBitmap* mBitmap, TIcon* mIcon, bool mSize32 = true)
{
///////begin var
int vIconWidth;
int vIconHeight;
Graphics::TBitmap* vBitmapMask;
Graphics::TBitmap* vBitmapColor;
TIconInfo vIconInfo;
///////end var
if ((mBitmap == NULL) || (mIcon == NULL)) return false;
if (mSize32) {
vIconWidth = 32;
vIconHeight = 32;
} else {
vIconWidth = 16;
vIconHeight = 16;
};
vBitmapMask = new Graphics::TBitmap;
vBitmapColor = new Graphics::TBitmap;
try {
vBitmapMask->Width = vIconWidth;
vBitmapMask->Height = vIconHeight;
vBitmapMask->Canvas->Brush->Color = clBlack;
vBitmapMask->Canvas->Rectangle(0, 0, vIconWidth, vIconHeight);
vBitmapColor->Width = vIconWidth;
vBitmapColor->Height = vIconHeight;
StretchBlt(vBitmapColor->Canvas->Handle, 0, 0, vIconWidth, vIconHeight,
mBitmap->Canvas->Handle, 0, 0, mBitmap->Width, mBitmap->Height, SRCCOPY);
vIconInfo.fIcon = true;
vIconInfo.xHotspot = 0;
vIconInfo.yHotspot = 0;
vIconInfo.hbmMask = vBitmapMask->Handle;
vIconInfo.hbmColor = vBitmapColor->Handle;
mIcon->Handle = CreateIconIndirect(&vIconInfo);
} __finally {
delete vBitmapMask;
delete vBitmapColor;
};
return true;
} /* BmpToIco */
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
BmpToIco(Image1->Picture->Bitmap, Image2->Picture->Icon);
}
//---------------------------------------------------------------------------
redsuns2001
2002-05-28
打赏
举报
回复
《程序员》Borland专刊中有提到。----Delphi常见图象格式转换技术。
紫色狂澜
2002-05-27
打赏
举报
回复
用ExTractIconEx()
参数index=0
搞定
dealxl
2002-05-26
打赏
举报
回复
何苦呢,直接用Imagelist,会帮你把位图分割掉,直接用在程序里。或者用Borland赠送的ImageEditor完全可以了啊
xiaohan13916830
2002-05-26
打赏
举报
回复
如果编程怎样实现?
shymeng
2002-05-24
打赏
举报
回复
在网上下载Iconcool吧,可以转换,功能强大得很...
BMP
转
ICO
的软件
标题 "
BMP
转
ICO
的软件" 指的是一个能够将位图(
BMP
)文件转换为图标(
ICO
)文件的工具。
ICO
是Windows操作系统中用于表示程序图标和桌面图标的文件格式,它能包含多个不同尺寸和色彩深度的图像,以适应不同的显示需求...
bmp
背景图
ico
图标合集
在IT领域,图像处理是不可或缺的一部分,而"
bmp
背景图
ico
图标合集"这个主题涉及到两种常见的图像格式:
BMP
和
ICO
,以及它们在实际应用中的转换和使用。以下是关于这两种格式及其相互转换的详细解释。
BMP
(Bitmap)...
把
Bmp
格式的图像转化成
Ico
的软件
在进行
BMP
转
ICO
的过程中,需要注意的是,由于
ICO
格式的特性,原始
BMP
图像可能需要进行适当的缩放和裁剪,以适应不同尺寸的图标需求。同时,高分辨率的
BMP
图像转换为
ICO
后,可能会丢失部分细节,这是由于
ICO
格式对...
BMP
与
ICO
图像互相转换
在IT领域,图像处理是不可或缺的一部分,特别是在软件开发中。本文将深入探讨如何使用VB(Visual Basic)编程语言实现
BMP
(Bitmap)和
ICO
(图标)两种图像格式之间的转换。
BMP
格式是一种常见的位图图像格式,它...
ICO
_
BMP
首先,您会找到压缩包内的`
ICO
_
BMP
.exe`,这是一个可执行文件,双击运行即可启动程序。软件界面直观,用户友好,旨在提供一个快速、无痛的转换过程。用户只需将需要转换的
ICO
图标文件拖放到程序界面上,或者通过菜单...
C++ Builder
13,873
社区成员
102,696
社区内容
发帖
与我相关
我的任务
C++ Builder
C++ Builder相关内容讨论区
复制链接
扫一扫
分享
社区描述
C++ Builder相关内容讨论区
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章