Solved

Converstion Icon to Bitmap

Posted on 1997-10-03
1
229 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
1 Comment
 
LVL 3

Accepted Solution

by:
mirek071497 earned 10 total points
Comment Utility
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

762 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now