怎么把bmp文件转化成ico文,jpg转bmp等等,谁有这方面的源程序?给兄弟一份[email protected]
解决方案 »
- XE3 怎么才回到古典的Delphi7
- 为什么我不能在IntraWeb下引用DataModule1,有详细的操作步骤!!!!这个问题已经困扰多时了 :-<帮帮我吧
- 自己开发短信功能,因该怎么做
- fastreport的问题
- 高手们,请问QRDBMEMO在哪里?
- 如何将sqlserver显示在dbgrid的数据导入到Access问题
- 运行关于SQL的问题,出现下面的错误,应该怎么办呢?在线等。。。。
- 菜鸟提问,关于Listbox的。,马上给分
- 怎么把hotkey和API函数registerHotKey()联系起来。
- 用delphi 5.0 在A客户端写得程序,运行良好。把它拷贝到B上运行,就出现错误。 高手
- 如何根据字体来确定label的长度?(100分)
- 请教:我在窗体上放置数据控件,建立数据连接,当关闭窗体时
procedure TFrmMyPreview.BMPSaveToJPG(sBMPFile :string);
var
B: TBitmap;
jp: TJpegImage;
begin
jp := TJpegImage.Create;
try
with jp do
begin
try
B := TBitmap.Create ;
B.LoadFromFile(trim(sBMPFile));
Assign(B);
SaveToFile(Copy(trim(sBMPFile),1,Length(trim(sBMPFile))-4)+'.jpg')
finally
B.free ;
end;
end;
finally
jp.Free;
end;
end;其他的你可以自己试试
如何把图标文件转换为位图文件
周剑峰 图 标 和 位 图 是WINDOWS 中 常 见 的 两 种 图 形 资源, 在 开 发 应 用 程 序 时, 充 分 地 运 用 这 些 资源 可 以 极 大 地 改 进 程 序 的 界 面, 增 强 软 件 的实 现 效 果。 例 如 在DELPHI 中, 我 们 可 以 给 应 用指 定 一 个 图 标, 给 位 图 命 令 按 钮 或 加 速 按 钮指 定 一 个 位 图 等。 许 多 开 发 工 具 都 提 供 有 大量 的 图 形 资 源, 包 括 位 图、 图 标、 光 标、 视 频文 件 等, 比 如 在DELPHI、Visual Basic 5.0 中 就 提 供有 大 量 的 位 图 和 图 标, 但 并 不 是 所 有 图 标 都有 相 应 的 位 图 文 件, 有 时 我 们 有 使 用 位 图 文件 时, 会 觉 得 某 个 图 标 的 图 形 更 合 适, 但 却没 有 相 应 的 位 图 文 件 可 以 使 用, 例 如DELPHI 中的 位 图 按 钮, 其Glyph 属 性 用 于 指 定 显 示 在 按钮 中 的 位 图, 但 该 属 性 只 能 使 用 位 图 文 件(.bmp), 而 不 能 使 用 图 标 文 件(.ico), 在 这 种 情况 下, 我 们 就 需 要 把 图 标 文 件 转 换 为
位 图 文件。
---- 利 用DELPHI 来 实 现 这 样 的 转 换 是 非 常 方 便的,DELPHI 把Windows 的 位 图 及 其 调 色 板 封 装在Tbitmap 类 中, 把Windows 图 标 封 装 在Ticon 中, 我们 只 需 把Tbitmap 和Ticon 的 属 性 和 方 法 作 些 简 单应 用, 就 可 以 实 现 图 标 文 件 到 位 图 文 件 的 转换。
---- 下 面 的 小 程 序 可 实 现 图 标 文 件 到 位 图 文件 的 转 换, 它 能 够 把 所 给 定 的 图 标 文 件 转 换为 同 名 的 位 图 文 件, 程 序 中 只 是 简 单 地 通 过程 序 扩 展 名 来 判 断 图 标 文 件 和 位 图 文 件。
---- 各 部 件 及 其 主 要 属 性 设 置 如 下:
部 件 属 性 属 性 值
Form1 Name ‘Form1’
Caption ‘ICO= >BMP’
StaticText1 Name ‘StaticText1’
Caption ‘ 图 标 文 件:’
Edit1 Name ‘Edit1’
Text ‘’
BitBtn_Browse Name ‘BitBtn_Browse’
Caption ‘ 浏 览...’
BitBtn_Convert Name ‘BitBtn_Convert’
Caption ‘ 转 换’
OpenDialog1 Name ‘OpenDialog1’
Filter ‘ 图 标 文 件(*.ico)|*.ico’
---- 实 现 转 换 的 源 程 序 如 下 所 示:
unit main;
interface
uses
Windows, Messages, SysUtils, Classes,
Graphics, Controls, Forms, Dialogs,
StdCtrls, Buttons;
type
TForm1 = class(Tform)
StaticText1: TStaticText;
BitBtn_Convert: TBitBtn;
OpenDialog1: TOpenDialog;
BitBtn_Browse: TBitBtn;
Edit1: Tedit;
procedure BitBtn_BrowseClick(Sender: Tobject);
procedure BitBtn_ConvertClick(Sender: Tobject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.BitBtn_BrowseClick(Sender: Tobject);
begin
if opendialog1.Execute then
edit1.Text := opendialog1.filename;
end;
procedure TForm1.BitBtn_ConvertClick(Sender: Tobject);
var
Icon1:Ticon;
Bitmap1:Tbitmap;
FileName,FileExt:String;
begin
if FileExists(Edit1.Text) then
begin
FileExt:= ExtractFileExt(Edit1.Text);
if UpperCase(FileExt)=`.ICO` then
begin
FileName:=copy(edit1.text,0,pos(`.ico`,edit1.text)-1);
icon1:=ticon.create;
bitmap1:=tbitmap.create;
icon1.loadfromfile(edit1.text);
Bitmap1.Width := Icon1.Width;
Bitmap1.Height := Icon1.Height;
Bitmap1.Canvas.Draw(0, 0, Icon1 );
Bitmap1.SaveToFile(FileName+`.bmp`);
Icon1.Free;
Bitmap1.Free;
ShowMessage(`文件转换成功!`);
end
else
ShowMessage(`所给定的文件不是图标文件!`);
end
else
ShowMessage(`所给文件不存在!`);
end;
end.
MyJpeg: TJpegImage;
bmp: Tbitmap;
begin
bmp:=tbitmap.Create;
MyJpeg:= TJpegImage.Create;
myjpeg.LoadFromFile('c:\windows\desktop\aa.jpg');
bmp.Assign(myjpeg);
bmp.SaveToFile('c:\windows\desktop\test.bmp'); // Save the JPEG to Disk
end;
你可以到http://www.playicq.com去下载我的 《数据库信使》,里面有你需要的东西!
进不去!!!!!!!!!!!
绝对可以
English :32x32 bit Bitmaps to ICO's
-----------------------------------
unit main;interfaceuses
Windows, Messages, SysUtils, Classes, Graphics, Controls,
Forms,Dialogs,ExtCtrls, StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
Image1: TImage;
Image2: TImage;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.DFM}procedure TForm1.Button1Click(Sender: TObject);
var winDC, srcdc, destdc : HDC;
oldBitmap : HBitmap;
iinfo : TICONINFO;
begin
GetIconInfo(Image1.Picture.Icon.Handle, iinfo); WinDC := getDC(handle);
srcDC := CreateCompatibleDC(WinDC);
destDC := CreateCompatibleDC(WinDC);
oldBitmap := SelectObject(destDC, iinfo.hbmColor);
oldBitmap := SelectObject(srcDC, iinfo.hbmMask); BitBlt(destdc, 0, 0, Image1.picture.icon.width,
Image1.picture.icon.height,
srcdc, 0, 0, SRCPAINT);
Image2.picture.bitmap.handle := SelectObject(destDC, oldBitmap);
DeleteDC(destDC);
DeleteDC(srcDC);
DeleteDC(WinDC);image2.Picture.Bitmap.savetofile(ExtractFilePath(Application.ExeName)
+ 'myfile.bmp');
end;procedure TForm1.FormCreate(Sender: TObject);
begin
image1.picture.icon.loadfromfile('c:\myicon.ico');
end;end.