Autor Tema: cómo hacer transparente PictureBox ?  (Leído 4317 veces)

0 Usuarios y 1 Visitante están viendo este tema.

vbgedo

  • Bytes
  • *
  • Mensajes: 10
  • Reputación: +0/-0
    • Ver Perfil
cómo hacer transparente PictureBox ?
« en: Junio 15, 2016, 12:58:25 am »
Hola a todos

Quiero hacer transparente PictureBox 50 % como el cambio de opacidad

esperando la ayuda

gracias a todos

LeandroA

  • Administrador
  • Petabyte
  • *****
  • Mensajes: 1128
  • Reputación: +151/-8
    • Ver Perfil
Re:cómo hacer transparente PictureBox ?
« Respuesta #1 en: Junio 15, 2016, 06:30:48 am »
hola no se puede hacer eso con un picturebox, a lo sumo se puede hacer un truco que es pintar en el picture el fondo del formulario con un 50% utilizando el api TransparentBlt de todas formas no le encuentro mucha finalidad hacerlo asi, quizas te sea mas util utilizar el ucImage

TheWatcher

  • Bytes
  • *
  • Mensajes: 16
  • Reputación: +2/-0
    • Ver Perfil
Re:cómo hacer transparente PictureBox ?
« Respuesta #2 en: Junio 15, 2016, 07:59:26 am »
Just as a handy tip, there's also a compatible GdiTransparentBlt() API directly in the Gdi32.dll library under any contemporary MS Windows OS starting with Windows 2000 Professional/Server and up.

So, if you have Gdi32.dll already loaded for other purposes in your application, there is no need to map yet another extra graphics library in the process address space.

vbgedo

  • Bytes
  • *
  • Mensajes: 10
  • Reputación: +0/-0
    • Ver Perfil
Re:cómo hacer transparente PictureBox ?
« Respuesta #3 en: Junio 15, 2016, 09:41:11 am »
hola no se puede hacer eso con un picturebox, a lo sumo se puede hacer un truco que es pintar en el picture el fondo del formulario con un 50% utilizando el api TransparentBlt de todas formas no le encuentro mucha finalidad hacerlo asi, quizas te sea mas util utilizar el ucImage


muchas gracias


Just as a handy tip, there's also a compatible GdiTransparentBlt() API directly in the Gdi32.dll library under any contemporary MS Windows OS starting with Windows 2000 Professional/Server and up.

So, if you have Gdi32.dll already loaded for other purposes in your application, there is no need to map yet another extra graphics library in the process address space.

muchas gracias

Virgil Tracy

  • Kilobyte
  • **
  • Mensajes: 64
  • Reputación: +38/-1
    • Ver Perfil
Re:cómo hacer transparente PictureBox ?
« Respuesta #4 en: Junio 21, 2016, 11:25:21 pm »
Lavolpe hace tiempo creo un truco para hacer un picturebox transparente

http://www.vbforums.com/showthread.php?601310-VB6-Fake-Transparency-for-PictureBox

Código: (VB) [Seleccionar]
Option Explicit

Private Type POINTAPI
    X As Long
    Y As Long
End Type
Private Declare Function SetViewportOrgEx Lib "gdi32.dll" (ByVal hDC As Long, ByVal nX As Long, ByVal nY As Long, ByRef lpPoint As POINTAPI) As Long
Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByRef lParam As Any) As Long
Private Declare Function ScreenToClient Lib "user32.dll" (ByVal hWnd As Long, ByRef lpPoint As POINTAPI) As Long
Private Declare Function ClientToScreen Lib "user32.dll" (ByVal hWnd As Long, ByRef lpPoint As POINTAPI) As Long
Private Const WM_PAINT As Long = &HF&

Private Sub Command1_Click()
    Dim vPt As POINTAPI
    With Picture1
       ClientToScreen .hWnd, vPt ' convert 0,0 to screen coords
       ScreenToClient .Container.hWnd, vPt ' convert that to container's coords
       SetViewportOrgEx .hDC, -vPt.X, -vPt.Y, vPt ' offset the picbox DC
       SendMessage .Container.hWnd, WM_PAINT, .hDC, ByVal 0& ' tell VB to repaint
       SetViewportOrgEx .hDC, vPt.X, vPt.Y, vPt ' reset picbox DC
       If .AutoRedraw = True then .Refresh
   End With
End Sub

vbgedo

  • Bytes
  • *
  • Mensajes: 10
  • Reputación: +0/-0
    • Ver Perfil
Re:cómo hacer transparente PictureBox ?
« Respuesta #5 en: Junio 30, 2016, 10:16:21 am »
Lavolpe hace tiempo creo un truco para hacer un picturebox transparente

http://www.vbforums.com/showthread.php?601310-VB6-Fake-Transparency-for-PictureBox

Código: (VB) [Seleccionar]
Option Explicit

Private Type POINTAPI
    X As Long
    Y As Long
End Type
Private Declare Function SetViewportOrgEx Lib "gdi32.dll" (ByVal hDC As Long, ByVal nX As Long, ByVal nY As Long, ByRef lpPoint As POINTAPI) As Long
Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByRef lParam As Any) As Long
Private Declare Function ScreenToClient Lib "user32.dll" (ByVal hWnd As Long, ByRef lpPoint As POINTAPI) As Long
Private Declare Function ClientToScreen Lib "user32.dll" (ByVal hWnd As Long, ByRef lpPoint As POINTAPI) As Long
Private Const WM_PAINT As Long = &HF&

Private Sub Command1_Click()
    Dim vPt As POINTAPI
    With Picture1
       ClientToScreen .hWnd, vPt ' convert 0,0 to screen coords
       ScreenToClient .Container.hWnd, vPt ' convert that to container's coords
       SetViewportOrgEx .hDC, -vPt.X, -vPt.Y, vPt ' offset the picbox DC
       SendMessage .Container.hWnd, WM_PAINT, .hDC, ByVal 0& ' tell VB to repaint
       SetViewportOrgEx .hDC, vPt.X, vPt.Y, vPt ' reset picbox DC
       If .AutoRedraw = True then .Refresh
   End With
End Sub

muchas gracias  :)