Put PNG image with an alpha channel on a Button
Moderator: Rathinagiri
Put PNG image with an alpha channel on a Button
Hi,
I was looking for a way to show the PNG images with an alpha channel on a Button control.
And I figured out how to do it.
The following image shows the result in MiniguiEx: And how it is showed in HMG 3.4.4 with the same PRG source: Your feedback is welcome
I was looking for a way to show the PNG images with an alpha channel on a Button control.
And I figured out how to do it.
The following image shows the result in MiniguiEx: And how it is showed in HMG 3.4.4 with the same PRG source: Your feedback is welcome
Kind Regards,
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
-
- Posts: 24
- Joined: Tue Nov 07, 2017 6:41 am
- DBs Used: DBF, Mysql
- Location: Capital Federal, Buenos Aires, ARGENTINA
Re: Put PNG image with an alpha channel on a Button
Envia el ejemplo
Gracias
Gracias
Re: Put PNG image with an alpha channel on a Button
Hello Jorge,
Thanks for your interest
My hugs to Argentina from Ukraine.
The sample source code is below:
Code: Select all
/*
* MINIGUI - Harbour Win32 GUI library
*/
#include "hmg.ch"
FUNCTION Main()
LOCAL aBtn, n
LOCAL cPngPath := ".\images\"
LOCAL aPng := {}
AEval( { 3, 1, 2, 6, 7, 8, 9, 10 }, {| c | ;
AAdd( aPng, cPngPath + "image" + hb_ntos( c ) + ".png" ) } )
aBtn := Array( Len( aPng ) )
DEFINE WINDOW Form_1 ;
AT 0, 0 ;
WIDTH 80 + 70 * Len( aPng ) ;
HEIGHT 430 ;
MAIN ;
TITLE 'Disabled Buttons Test' ;
NOSIZE ;
NOMAXIMIZE
@ 40, 40 LABEL Lbl_1 VALUE "ENABLED BUTTONS NORMAL LOOK" AUTOSIZE
FOR n := 1 TO Len( aPng )
aBtn[ n ] := "Btn1_" + hb_ntos( n )
DEFINE BUTTON &( aBtn[ n ] )
ROW 70
COL n * 70 - 30
ACTION NIL
PICTURE aPng[ n ]
WIDTH 64
HEIGHT 64
END BUTTON
NEXT
@ 150, 40 LABEL Lbl_2 VALUE "LOADED PICTURES NORMAL LOOK" AUTOSIZE
FOR n := 1 TO Len( aPng )
aBtn[ n ] := "Img2_" + hb_ntos( n )
DEFINE IMAGE &( aBtn[ n ] )
ROW 180
COL n * 70 - 20
ACTION NIL
PICTURE aPng[ n ]
TRANSPARENT .T.
END IMAGE
NEXT
@ 260, 40 LABEL Lbl_3 VALUE "DISABLED BUTTONS" AUTOSIZE
FOR n := 1 TO Len( aPng )
aBtn[ n ] := "Btn3_" + hb_ntos( n )
DEFINE BUTTON &( aBtn[ n ] )
ROW 290
COL n * 70 - 30
ACTION NIL
PICTURE aPng[ n ]
WIDTH 64
HEIGHT 64
END BUTTON
Form_1.&( aBtn[ n ] ).Enabled := .F.
NEXT
END WINDOW
CENTER WINDOW Form_1
ACTIVATE WINDOW Form_1
RETURN NIL
Last edited by gfilatov on Fri Mar 31, 2023 7:08 am, edited 1 time in total.
Kind Regards,
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
- serge_girard
- Posts: 3168
- Joined: Sun Nov 25, 2012 2:44 pm
- DBs Used: 1 MySQL - MariaDB
2 DBF - Location: Belgium
- Contact:
Re: Put PNG image with an alpha channel on a Button
Thanks Grigory !
Serge
Serge
There's nothing you can do that can't be done...
-
- Posts: 24
- Joined: Tue Nov 07, 2017 6:41 am
- DBs Used: DBF, Mysql
- Location: Capital Federal, Buenos Aires, ARGENTINA
Re: Put PNG image with an alpha channel on a Button
Gracias Grigori
Me fusta mucho este lenguaje, empece con Clipper en 1987, y hice grandes sistemas, y con Migui extende, logro mejores programas.
Una consulta:
-uso Harbour MiniGUI Extended Edition 23.02 (Release), y compilo con bcc10.2
al compilar el ejemplo D:\MiniGUI\SAMPLES\BASIC\MYSQL\Demo_2.prg, me da el siguiente error:
Turbo Incremental Link 5.69 Copyright (c) 1997-2005 Borland
Error: Unresolved external '_HB_FUN_TMYSQLSERVER' referenced from
C:\USERS\JORGE\APPDATA\LOCAL\TEMP\HBMK_7GCBMP.DIR\DEMO_2.OBJ
hbmk2: Error: Running linker. 2
Presione una tecla para continuar . . .
En cambio si compilo con Compile.bat que esta en el directorio no hay drama, sera por que usa Bcc58??
Si podes ayudarme, ya que compilo todo con Bcc10.2
sera que la libreria hbmysql.lib que crea la version de Minigui esta Bcc58??
A pesar que la version Bcc10.2 tiene tb esa libreria hbmysql.lib en su carpeta.
Tenes idea que puede pasar??
-queria mandarte mensaje privado, pero no se puede mandarte.
Espero estes muy bien en ese hermoso pais de hermosas mujeres
Me fusta mucho este lenguaje, empece con Clipper en 1987, y hice grandes sistemas, y con Migui extende, logro mejores programas.
Una consulta:
-uso Harbour MiniGUI Extended Edition 23.02 (Release), y compilo con bcc10.2
al compilar el ejemplo D:\MiniGUI\SAMPLES\BASIC\MYSQL\Demo_2.prg, me da el siguiente error:
Turbo Incremental Link 5.69 Copyright (c) 1997-2005 Borland
Error: Unresolved external '_HB_FUN_TMYSQLSERVER' referenced from
C:\USERS\JORGE\APPDATA\LOCAL\TEMP\HBMK_7GCBMP.DIR\DEMO_2.OBJ
hbmk2: Error: Running linker. 2
Presione una tecla para continuar . . .
En cambio si compilo con Compile.bat que esta en el directorio no hay drama, sera por que usa Bcc58??
Si podes ayudarme, ya que compilo todo con Bcc10.2
sera que la libreria hbmysql.lib que crea la version de Minigui esta Bcc58??
A pesar que la version Bcc10.2 tiene tb esa libreria hbmysql.lib en su carpeta.
Tenes idea que puede pasar??
-queria mandarte mensaje privado, pero no se puede mandarte.
Espero estes muy bien en ese hermoso pais de hermosas mujeres
Re: Put PNG image with an alpha channel on a Button
Dear Jorge,jorge_rivero wrote: ↑Fri Mar 31, 2023 2:16 pm Gracias Grigori
Me fusta mucho este lenguaje, empece con Clipper en 1987, y hice grandes sistemas, y con Migui extende, logro mejores programas.
Una consulta:
-uso Harbour MiniGUI Extended Edition 23.02 (Release), y compilo con bcc10.2
al compilar el ejemplo D:\MiniGUI\SAMPLES\BASIC\MYSQL\Demo_2.prg, me da el siguiente error:
Turbo Incremental Link 5.69 Copyright (c) 1997-2005 Borland
Error: Unresolved external '_HB_FUN_TMYSQLSERVER' referenced from
C:\USERS\JORGE\APPDATA\LOCAL\TEMP\HBMK_7GCBMP.DIR\DEMO_2.OBJ
hbmk2: Error: Running linker. 2
Presione una tecla para continuar . . .
En cambio si compilo con Compile.bat que esta en el directorio no hay drama, sera por que usa Bcc58??
Si podes ayudarme, ya que compilo todo con Bcc10.2
sera que la libreria hbmysql.lib que crea la version de Minigui esta Bcc58??
A pesar que la version Bcc10.2 tiene tb esa libreria hbmysql.lib en su carpeta.
Tenes idea que puede pasar??
-queria mandarte mensaje privado, pero no se puede mandarte.
Espero estes muy bien en ese hermoso pais de hermosas mujeres
It seems that you have mixed your Bcc58 and Bcc10.2 compilers.
The message from Bcc10.2 linker should be as below:
You may send a message to my private email gfilatov/@/gmail.com for further explanations.Turbo Incremental Link 6.90 Copyright (c) 1997-2017 Embarcadero Technologies, Inc.
Kind Regards,
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
-
- Posts: 44
- Joined: Tue Dec 08, 2020 11:37 am
- DBs Used: DBF,MySQL,PostgreSQL
- Location: Brasil
- Contact:
Re: Put PNG image with an alpha channel on a Button
Hi To All ,
How to make Draw Transparent in Hmg? I didn´t get Transparent effect in HMG as it Gets in MINIGUI.
Thank´s in Advance
How to make Draw Transparent in Hmg? I didn´t get Transparent effect in HMG as it Gets in MINIGUI.
Thank´s in Advance
Re: Put PNG image with an alpha channel on a Button
Hello everyone
I have 2 questions
1. half of my buttons are grayed out, what's causing it, I can remove it. There are nice white ones in the attachment from gfilatov.
2. is the way to implement the mentioned adjustment in HMG
Georg
I have 2 questions
1. half of my buttons are grayed out, what's causing it, I can remove it. There are nice white ones in the attachment from gfilatov.
2. is the way to implement the mentioned adjustment in HMG
Georg
- Attachments
-
- Button_gray.jpg (36.71 KiB) Viewed 14869 times
-
- Posts: 44
- Joined: Tue Dec 08, 2020 11:37 am
- DBs Used: DBF,MySQL,PostgreSQL
- Location: Brasil
- Contact:
Re: Put PNG image with an alpha channel on a Button
Hi To All ,
As you can See in Hmg Version there is a little Black Border . In Minigui version it does not exist this black border
As you can See in Hmg Version there is a little Black Border . In Minigui version it does not exist this black border
Re: Put PNG image with an alpha channel on a Button
I'm talking about the gray half of the button