Solved

Converstion Icon to Bitmap

Posted on 1997-10-03
1
243 Views
Last Modified: 2010-04-04
How can I convert a Icon to a Bitmap in Delphi 2?

Points will be increased depending on the answer.

Regards Ian
0
Comment
Question by:e4monsch
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 3

Accepted Solution

by:
mirek071497 earned 10 total points
ID: 1346795
This is the easiest way :

var
  bmp : TBitmap;
  ico : TIcon;
  TmpDC : HDC;
begin
  ico := TIcon.Create;
  ico.LoadFromFile( 'd:\chip.ico' );
  bmp := TBitmap.Create;
  bmp.width := ico.width;
  bmp.Height := ico.Height;
  TmpDC := CreateCompatibleDC( 0 );
  DeleteObject( SelectObject( TmpDC, bmp.Handle ) );
  if DrawIcon( TmpDC, 0, 0, ico.handle ) then
    bmp.SaveToFile( 'd:\chip.bmp' )
  else
    ShowMessage ('I can''t convert' );
  DeleteDC( TmpDC );
  bmp.Free;
  ico.Free;
end;

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question