Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Gráficos
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 11-11-2003
seduerey seduerey is offline
Miembro
 
Registrado: jun 2003
Posts: 60
Poder: 21
seduerey Va por buen camino
Formularios transparentes con imágenes

bien, he intentado probar las coolforms, pero no han acabado de funcionarme correctamente, y me han pasado un codigo en Visual Basic que hace llamadas a las apis de windows, y me gustaria saber si es posible realizarlo análogamente en Delphi, y que tipos son los que deberia usar...

Public Function GetBitmapRegion(cPicture As StdPicture, cTransparent As Long)
'Variable Declaration
Dim hRgn As Long, tRgn As Long
Dim X As Integer, Y As Integer, X0 As Integer
Dim hDC As Long, BM As BITMAP
'Create a new memory DC, where we will scan the picture
hDC = CreateCompatibleDC(0)
If hDC Then
'Let the new DC select the Picture
SelectObject hDC, cPicture
'Get the Picture dimensions and create a new rectangular
'region
GetObject cPicture, Len(BM), BM
hRgn = CreateRectRgn(0, 0, BM.bmWidth, BM.bmHeight)
'Start scanning the picture from top to bottom
For Y = 0 To BM.bmHeight
For X = 0 To BM.bmWidth
'Scan a line of non transparent pixels
While X <= BM.bmWidth And GetPixel(hDC, X, Y) <> cTransparent
X = X + 1
Wend
'Mark the start of a line of transparent pixels
X0 = X
'Scan a line of transparent pixels
While X <= BM.bmWidth And GetPixel(hDC, X, Y) = cTransparent
X = X + 1
Wend
'Create a new Region that corresponds to the row of
'Transparent pixels and then remove it from the main
'Region
If X0 < X Then
tRgn = CreateRectRgn(X0, Y, X, Y + 1)
CombineRgn hRgn, hRgn, tRgn, 4
'Free the memory used by the new temporary Region
DeleteObject tRgn
End If
Next X
Next Y
'Return the memory address to the shaped region
GetBitmapRegion = hRgn
'Free memory by deleting the Picture
DeleteObject SelectObject(hDC, cPicture)
End If
'Free memory by deleting the created DC
DeleteDC hDC
End Function


Se que os parecerá extraño, es para lograr que se vea la parte de detrás de un formulario, para que haya partes "transparentes" en todas las plataformas Win32, tal y como hace el Nero 6, por ejemplo

Gracias de antemano
Responder Con Cita
  #2  
Antiguo 11-11-2003
Avatar de delphi.com.ar
delphi.com.ar delphi.com.ar is offline
Federico Firenze
 
Registrado: may 2003
Ubicación: Buenos Aires, Argentina *
Posts: 5.932
Poder: 27
delphi.com.ar Va por buen camino
Sin haberlo probado, puedo decirte que no son formularios con transparencia REAL, en los formularios transparentes de WinXP, cada pixel es una combinación del valor de color del formulario con el fondo. En este caso lo que logras es tener un formulario irregular, digamos no rectangular, donde hay partes del formulario que no se ven, en cambio en los formularios transparentes de WinXP, se ven todas las partes del form (a no ser que sea un formulario irregular como estos).
Si haces un formulario con una región del tipo cuadrícula (Un pixel si, otro no, otro si....)... dará una sensación "barata" de transparencia.

Saludos!
__________________
delphi.com.ar

Dedique el tiempo suficiente para formular su pregunta si pretende que alguien dedique su tiempo en contestarla.
Responder Con Cita
Respuesta



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro


La franja horaria es GMT +2. Ahora son las 11:03:36.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi