| |
|
|
- Page 1 - |
|
Georg Teles | SetMenuItemBitmap-Unit
Transparentes Bitmap on MenuItem settle, Style to maintain
Bitmap with a Alpha-channel a Instance transparent on one arbitrary MenuItem one already existierenden Menüs setting, without whom Style the Menüs To Change
functions on TrackMenu, though must it already loaded been his (s. externes Menu as TrackMenu [...] )
Download
encompassed main.bmp is with a Alpha-channel slip, must naturally in PROFAN.EXE to that testing eingebunden go
Win XP Win Vista Win 7 Win 8 Win 10 |
|
|
| |
|
|
|
| |
|
- Page 1 - |
|
| the what you mean shining itself me sooner on BitBlit-Operationen [...] To relating - there can in the principle 1 colour as transparent (or. not To überzeichnen) define. is mostly colour 0.
so draw Roland then too z.B. with Loadbmp ...; -1
the has with Transluzenz or. Alpha-channel then but nothing To do.
How was because only... draw windows with this Menu-Bildchen not anyhow ever a defined colour transparent?! me was so...
I wealth, that Roland the rather white. |
|
|
| |
|
|
|
RGH | I have the whole time to that Anlass taken, in the coming XProfan X3 too with normalen Menüs Icons To permit. The Syntax is the same How with whom Customdraw-Menüs, only that the Icon-lever as negativer worth indicated becomes.
there windows not directly Icons, separate a Bitmap with normalen Menüs expects, have I moreover a routine written, The one Icon in a Bitmap umwandelt.
to transparency: with whom Customdraw-Menüs make I Yes eh' everything self, that is, I draw the Icon the Menu. Icons having Yes of itself from transparency and there must I not therefore concern.
Hierbei counts not a Frabe as transparent, separate Icons having another so-called mask: a zweifarbige Black/weiße Bitmap, with the The Pixel Black are, The not transparent are. circa now then a Bitmap one Icon To produce, beget I a vain Bitmap the Size the Icons and copy now Pixel for Pixel The Bitmap of the Icons into new Bitmap, where I only whom black Pixeln the mask The Original-colour take and with whom übrigen Pixeln, The before ermittelte Systemfarbe the Menu-Hintergrunds:
function IconToBitmap(DC: hDC; Icon: THandle; bc: integer): THandle; var bmpResult: tHandle; bmpColorOld, bmpMaskOld, bmpResultOld: tHandle; IInfo: ICONINFO; hdcColor, hdcMask, hdcResult: tHandle; c, m, x, y, dx, dy: integer; begin bmpResult := 0; If GetIconInfo(Icon, IInfo) then begin dx := IInfo.xHotspot * 2; dy := IInfo.yHotspot * 2; bmpResult := CreateCompatibleBitmap(DC, dx, dy); // DCs produce hdcColor := createCompatibleDC(DC); hdcMask := createCompatibleDC(DC); hdcResult := createCompatibleDC(DC); // Bitmaps allocate bmpColorOld := SelectObject(hdcColor, IInfo.hbmColor); bmpMaskOld := SelectObject(hdcMask, IInfo.hbmMask); bmpResultOld := SelectObject(hdcResult, bmpResult); for x := 0 to dx - 1 do begin for y := 0 to dy - 1 do begin c := getPixel(hdcColor,x,y); m := getPixel(hdcMask,x,y); if m = 0 then setPixel(hdcResult,x,y,c) else setPixel(hdcResult,x,y,bc); end; end; // Result allocate bmpResult := SelectObject(hdcResult, bmpResultOld); // straighten up DeleteObject(SelectObject(hdcMask, bmpMaskOld)); DeleteObject(SelectObject(hdcColor, bmpColorOld)); DeleteObject(IInfo.hbmColor); DeleteObject(IInfo.hbmMask); DeleteDC(hdcColor); DeleteDC(hdcMask); DeleteDC(hdcResult); end; Result := bmpResult; end;
Can whom komischen code-Formatierer too turn off, so the code so displayed becomes, How I it written have? I hate programs, The believe for me mitdenken To must. Greeting Roland |
|
|
| Intel Duo E8400 3,0 GHz / 4 GB RAM / 1000 GB HDD - ATI Radeon HD 4770 512 MB - Windows 7 Home Premium 32Bit - XProfan X4 | 02/17/16 ▲ |
|
|
|
|
Georg Teles | iF (17.02.2016)
the has with Transluzenz or. Alpha-channel then but nothing To do. How was because only... draw windows with this Menu-Bildchen not anyhow ever a defined colour transparent?! me was so...
very, so has the nothing zutun, in XP becomes presumably a defined colour transparent made or. becomes "ersetzt" , know yet The "Pinke" colour hehe --- be already over very these function stumbled, time look whether the works |
|
|
| |
|
|
|
Georg Teles | RGH (17.02.2016)
there windows not directly Icons, separate a Bitmap with normalen Menüs expects, have I moreover a routine written, The one Icon in a Bitmap umwandelt.
Aaah have The routine not yet integrally understood: accurate what You with RGH (17.02.2016)
and with whom übrigen Pixeln, The before ermittelte Systemfarbe the Menu-Hintergrunds mean, because once one whom Fokus the Menu has, becomes the background the Menüs Yes differently as without Fokus ? Ähnliches Tutorial with BitBlit have I to 2 Meet already seen [...] times the routine try whether tappt im dunkeln the same täten does How the Tutorial
RGH (17.02.2016)
Can whom komischen code-Formatierer too turn off, so the code so displayed becomes, How I it written have? I hate programs, The believe for me mitdenken To must.
HA the can I neither endure, particularly programs The without advance notice something do what not would like |
|
|
| |
|
|
|
RGH | to Calling the supra showed routine ermittele I with the API getSysColor(color_menu) The Backgroundcolor the Menüs. These becomes in bc transfer. (The first Parameter is the active DeviceContext, the second the Icon-lever and the dritte The Backgroundcolor.)
the Change the colour at Darüberfahren with the mouse Done windows. the Menu is to the Time already drawn.
The Size the Icons ermittle I over The position the Hotspots, there this with Icons always exakt in the middle lying. (with one Cursor would The investigation one the Size something aufwändiger, there tappt im dunkeln not in the Info-structure drin standing.) Also ermittle have I in the Info-structure the lever to farbigen Bitmap and to Masken-Bitmap. around the Bitmaps now To Edit, must one whom Bitmaps now one DeviceContext allocate, likewise the Result-Bitmap. The übliche Verwaltungsaufwand hold, if one directly with the API program. in the Loop read I then Pixel for Pixel The colour the farbigen Bitmap and at the same time The the suitable Pixels the mask. is this 1, set I the suitable Pixel the Result-Bitmap on The colour, is it 0, then on The Backgroundcolor. And then is yet the übliche straighten up angesagt.
Greeting Roland |
|
|
| Intel Duo E8400 3,0 GHz / 4 GB RAM / 1000 GB HDD - ATI Radeon HD 4770 512 MB - Windows 7 Home Premium 32Bit - XProfan X4 | 02/17/16 ▲ |
|
|
|
|
Georg Teles | Aaah many Thanks for detailed Statement, now is einleuchtend wieso since the Höhe / wide * 2 standing, because Hotspot the Icons in the middle is
RGH (17.02.2016)
the Change the colour at Darüberfahren with the mouse Done windows. the Menu is to the Time already drawn.
so klärt the question thanks |
|
|
| |
|
|
|
Georg Teles | Hello!
RGH (17.02.2016)
the Change the colour at Darüberfahren with the mouse Done windows. the Menu is to the Time already drawn.
understand I the right, means the, each time at Fokusieren the Menu becomes IconToBitmap carryed out ?
Regards |
|
|
| |
|
|
|
| [OFFTOPIC] RGH (17.02.2016)Can whom komischen code-Formatierer too turn off, so the code so displayed becomes, How I it written have?
Yes, now, simply whom View source with a exclamation points begin - Have your obigen Posting properly adjusted. [/OFFTOPIC] |
|
|
| |
|
|
| |
|
- Page 2 - |
|
|
RGH | [OFFTOPIC] iF (20.02.2016)Can whom komischen code-Formatierer too turn off, so the code so displayed becomes, How I it written have?
iF (20.02.2016)Yes, now, simply whom View source with a exclamation points begin - Have your obigen Posting properly adjusted.
thanks! I knew still, that there what was. I hope only, I the until next time not again forget have. [/OFFTOPIC] |
|
|
| XProfan X3Intel Duo E8400 3,0 GHz / 4 GB RAM / 1000 GB HDD - ATI Radeon HD 4770 512 MB - Windows 7 Home Premium 32Bit - XProfan X4 | 02/20/16 ▲ |
|
|
|
|
RGH | Georg Teles (20.02.2016)
Hello! RGH (17.02.2016)the Change the colour at Darüberfahren with the mouse Done windows. the Menu is to the Time already drawn.
understand I the right, means the, each time at Fokusieren the Menu becomes IconToBitmap carryed out ? Regards
No, only einmalig at XProfanbefehl APPENMENU, ISERTMENU or SUBPOPUP. very there becomes The Bitmap the Icon created and the suitable API the exhaust allocated. windows draw then the Aufklappen the Menüs the Menu with the allocated Bitmaps. whom effect, the at Fokusieren arise, created windows selbsttätig.
(with User-Drawn-Menüs, means them with positive Icon-Handles, is it something differently. there power windows quite nothing at Aufklappen or Darüberfahren with the mouse, except Messages To Send and Parameter (where and how etc.) bereitzustellen. the draw undertaking here then XProfan self. there then z.B. The Icons directly the Menu drawn.)
Greeting Roland |
|
|
| Intel Duo E8400 3,0 GHz / 4 GB RAM / 1000 GB HDD - ATI Radeon HD 4770 512 MB - Windows 7 Home Premium 32Bit - XProfan X4 | 02/20/16 ▲ |
|
|
|
|
Georg Teles | understand, very very well |
|
|
| |
|
|
|
Georg Teles | Update v.1.0 - then even at least ex windows Vista ($WinVer >= 6.0) |
|
|
| |
|
|