IMAGE - Control

HMG en Español

Moderator: Rathinagiri

Post Reply
User avatar
SALINETAS24
Posts: 667
Joined: Tue Feb 27, 2018 3:06 am
DBs Used: DBF
Contact:

IMAGE - Control

Post by SALINETAS24 »

Hola, tengo un control IMAGE donde el usuario puede seleccionar la imagen a mostrar, pero cuando quiere dejarlo en blanco siempre tiene la ultima imagen tratada. ¿hay alguna forma de hacerlo..?
He visto en el foro ya que fue detectado este problema y que se aportaba una solución a través del color y usando sintaxis OOP's...
¿Alguna solución más chula...?
Gracias y una cervecita. ;)


l3whmg wrote: Wed Nov 30, 2011 10:20 am Hi friends.

I found a "problem" with bitmap. If I set Picture := "", previous loaded image doesn't disappear.
It's not a real problem because, many times, every one of us creates an empty image to load.

To avoid creating empty image, I add method EmptyColor( aArg1 ), where aArg1 is an array of RGB colors. By default, this is an empty array.
When bitmap fails to load the image, if EmptyColor has a valid array of RGB colors a colored image will be created
In this way, you can always see an image: existing image or empty image.
If you reset ( EmptyColor := {} ), you don't will see a colored image and the bitmap behaviour will be like today.

Usage with OOP syntax

Code: Select all

            WITH OBJECT ::oImage := BITMAP():New()
               :Row           := 150
               :Col           := 65
               :Width         := 500
               :Height        := 300
               :Picture       := ""
               :Stretch       := .T.
               :EmptyColor    := { 158, 158, 158 }
            END WITH

Code: Select all

2011-11-30 11:10 UTC+0100 Luigi Ferraris ( <luigi at l3w.it> )
   * source/bitmap.prg
     + EmptyColor( aArg1 ) method where aArg1 is an array of RGB colors or an
       empty array (by default empty array). When bitmap fails to load the 
       image, if EmptyColor has a valid array of RGB colors, a colored image 
       will be created.
Cheers
Como dijo el gran pensador Hommer Simpson..., - En este mundo solo hay 3 tipos de personas, los que saben contar y los que no. :shock:
User avatar
SALINETAS24
Posts: 667
Joined: Tue Feb 27, 2018 3:06 am
DBs Used: DBF
Contact:

Re: IMAGE - Control

Post by SALINETAS24 »

Hola a todos, ya lo tengo solucionado.
Lo que hago es detectar si tengo algo que mostrar, y si la cadena que contiene la localización de la imagen esta vacía desactivo el control.

Salud y una cervecita!!

Code: Select all

	Win_Maus.lFoto.Value:=aField[6]
	IF Empty(aField[6])
		Win_MaUs.Image_1.Visible:=.F.
		ELSE
		Win_MaUs.Image_1.Visible:=.T.
	ENDIF
Como dijo el gran pensador Hommer Simpson..., - En este mundo solo hay 3 tipos de personas, los que saben contar y los que no. :shock:
Post Reply