🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Creating an icon (short)

#15996
From: Chris
Date: Tue, 03 Jun 2003 17:29
72 lines
3145 bytes
Black is a TImage containing a black picture.
Anyway, that code will probably work, it resembles code I've tried a lot,
but it won't actually save the icon....
Thanks, though. :)

"Hans Galema" <j.m.galema.dontusethis@maartens.nl> wrote in message
news:3ed9cf52$1@newsgroups.borland.com...
> 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: <3edcdaf8$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail
References: <3ed974e4$1@newsgroups.borland.com> <3ed9cf52$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-03 10:33:06 PST
From: "Chris" <Chris8852@adelphia.net>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3ed974e4$1@newsgroups.borland.com> <3ed9cf52$1@newsgroups.borland.com>
Subject: Re: Creating an icon (short)
Date: Tue, 3 Jun 2003 13:29:29 -0400
Lines: 74
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 68.65.164.124
Message-ID: <3edcdaf8$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1054661368 68.65.164.124 (3 Jun 2003 10:29:28 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail