🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #16052

Re: Creating an icon (short)

#16052
From: Eudy Silva
Date: Mon, 02 Jun 2003 01:32
67 lines
2913 bytes
In case you're not seeing it, you got a reply to your
post from Hans Galema.
Here is a copy of his reply:

Chris wrote:

 > i.hbmMask = Black->Picture->Bitmap->Handle;

Black is a TImage ? What does it contain ?

Did a google advanced newsgroups search on
text:   ICONINFO CreateIconIndirect
groups: *cppbuilder*

found something what could be of use.

Hans.

Van:PaoloItaly (paolo@sirius.tecnoparco.it)
Onderwerp:Re: text on the tray
View: Complete Thread (3 bijdragen)
Original Format
Discussies:borland.public.cppbuilder.winapi
Datum:2002-04-22 04:09:01 PST

draw text in a TBitmap with TextOut and the trasform the bitmap in icon

Graphics::TIcon *BitmapToIcon(Graphics::TBitmap *Bitmap, int IconSizeX, int
IconSizeY)
{
   ICONINFO IconInfo;
   Graphics::TBitmap *IconBitmap, *MaskBitmap;
   int x, y;
   TColor TransparentColor;
   Graphics::TIcon *Result

   if(IconSizeX == -1)
   {
     IconSizeX = ::GetSystemMetrics(SM_CXICON);
     IconSizeY = ::GetSystemMetrics(SM_CYICON);
   }
   IconBitmap = new Graphics::TBitmap;
   IconBitmap->Width = IconSizeX;
   IconBitmap->Height = IconSizeY;
   IconBitmap->Canvas->StretchDraw(Rect(0, 0, IconSizeX, IconSizeY), 
Bitmap);
   IconBitmap->TransparentColor = Bitmap->TransparentColor;
   TransparentColor = (TColor)(IconBitmap->TransparentColor & 0xFFFFFF);
   MaskBitmap = new Graphics::TBitmap;
   MaskBitmap->Assign(IconBitmap);
   for(y= 0; y < IconSizeY - 1 ;y++)
     for(x= 0; x < IconSizeX - 1 ;x++)
       if(IconBitmap->Canvas->Pixels[x][y] == TransparentColor)
         IconBitmap->Canvas->Pixels[x][y] = clBlack;
   IconInfo.fIcon    = true;
   IconInfo.hbmMask  = MaskBitmap->MaskHandle;
   IconInfo.hbmColor = IconBitmap->Handle;

   Result = new Graphics::TIcon;
   Result->Handle = ::CreateIconIndirect(&IconInfo);
   delete MaskBitmap;
   delete IconBitmap;

   return Result;
}

Ciao
Technical Details
Message-ID: <3EDAA92A.4070908@directnet.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail
References: <3eda4ab0$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,1a231bbe6eb7638e
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-06-01 18:36:20 PST
Message-ID: <3EDAA92A.4070908@directnet.com>
Date: Sun, 01 Jun 2003 22:32:26 -0300
From: Eudy Silva <eudy@directnet.com>
User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.0.2) Gecko/20021120 Netscape/7.01
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Creating an icon (short)
References: <3eda4ab0$1@newsgroups.borland.com>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 200.152.8.215
X-Trace: newsgroups.borland.com 1054517421 200.152.8.215 (1 Jun 2003 18:30:21 -0700)
Lines: 68
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail