Visual Basic Foro
Programación => Visual Basic 6 => Mensaje iniciado por: vbgedo 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
-
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 (http://allapi.mentalis.org/apilist/0EABF4FC8C988228BA9EF479040F99DD.html)de todas formas no le encuentro mucha finalidad hacerlo asi, quizas te sea mas util utilizar el ucImage (http://leandroascierto.com/blog/ucimage-y-ucimagelist/)
-
Just as a handy tip, there's also a compatible GdiTransparentBlt() (https://msdn.microsoft.com/en-us/library/dd373586(v=vs.85).aspx) 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.
-
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 (http://allapi.mentalis.org/apilist/0EABF4FC8C988228BA9EF479040F99DD.html)de todas formas no le encuentro mucha finalidad hacerlo asi, quizas te sea mas util utilizar el ucImage (http://leandroascierto.com/blog/ucimage-y-ucimagelist/)
muchas gracias
Just as a handy tip, there's also a compatible GdiTransparentBlt() (https://msdn.microsoft.com/en-us/library/dd373586(v=vs.85).aspx) 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
-
Lavolpe hace tiempo creo un truco para hacer un picturebox transparente
http://www.vbforums.com/showthread.php?601310-VB6-Fake-Transparency-for-PictureBox (http://www.vbforums.com/showthread.php?601310-VB6-Fake-Transparency-for-PictureBox)
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
-
Lavolpe hace tiempo creo un truco para hacer un picturebox transparente
http://www.vbforums.com/showthread.php?601310-VB6-Fake-Transparency-for-PictureBox (http://www.vbforums.com/showthread.php?601310-VB6-Fake-Transparency-for-PictureBox)
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 :)