C è la possibilità di dare una trasparenza ai controlli (ad esempoio text o anche button) in modo tale che si veda l immagine di sfondo della form?
C è la possibilità di dare una trasparenza ai controlli (ad esempoio text o anche button) in modo tale che si veda l immagine di sfondo della form?
Devi indicare il linguaggio a cui riferimento (e la versione in caso di VB), come indicato nel Regolamento che dovresti leggere con urgenza.
Forniscimi queste informazioni così posso introdurle nel titolo della discussione.
Ciao!![]()
MARCO BREVEGLIERI
Software and Web Developer, Teacher and Consultant
Home | Blog | Delphi Podcast | Twitch | Altro...
Il linguaggio è visual basic e la versione è la 6...sapete aiutarmi?v prego!![]()
Questo esempio è applicato a tre TextBox, ma si può applicare ad altri controlli:Originariamente inviato da D team software
C è la possibilità di dare una trasparenza ai controlli (ad esempoio text o anche button) in modo tale che si veda l immagine di sfondo della form?
Const LWA_COLORKEY = &H1
Const LWA_ALPHA = &H2
Const GWL_EXSTYLE = (-20)
Const WS_EX_LAYERED = &H80000
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hWnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Private Sub Form_Load()
Dim Ret As Long
Ret = GetWindowLong(Me.hWnd, GWL_EXSTYLE)
Ret = Ret Or WS_EX_LAYERED
SetWindowLong Me.hWnd, GWL_EXSTYLE, Ret
SetLayeredWindowAttributes Me.hWnd, 0, 128, LWA_ALPHA
SetLayeredWindowAttributes Form1.hWnd, &HFFFFFF, 0, LWA_COLORKEY
Ret = GetWindowLong(Text1.hWnd, GWL_EXSTYLE)
Ret = Ret Or WS_EX_LAYERED
SetWindowLong Text1.hWnd, GWL_EXSTYLE, Ret
SetLayeredWindowAttributes Text1.hWnd, &HC000&, 0, LWA_COLORKEY
Ret = GetWindowLong(Text2.hWnd, GWL_EXSTYLE)
Ret = Ret Or WS_EX_LAYERED
SetWindowLong Text2.hWnd, GWL_EXSTYLE, Ret
SetLayeredWindowAttributes Text2.hWnd, &HFF&, 0, LWA_COLORKEY
Ret = GetWindowLong(Text3.hWnd, GWL_EXSTYLE)
Ret = Ret Or WS_EX_LAYERED
SetWindowLong Text3.hWnd, GWL_EXSTYLE, Ret
SetLayeredWindowAttributes Text3.hWnd, &H8000000F, 0, LWA_COLORKEY
End Sub
Però funziona solo su win2000, xp e successivi, non su Win9x/Me.
Socket2000 ha ragione. Però puoi proteggere la routine introducendo una funzione che verifichi il SO in uso, nel caso di Win_XP prosegue altrimenti no.
Se ti occorre la posto.
Fammi sapere.![]()
LM
scusate magari mi caccerete dal forum per questa domandama nn so dove mettere precisamente il codice...
Se fai un copia incolla su un modulo della Frm ti accorgi subito.
Comunque, in linea di massima:
le costanti e le dichiarazioni (Private Declare...): nella sezione Generale, del modulo della Frm;
Il resto nell'evento interessato della Frm (nell'esempio Private Sub Form_Load() )![]()
LM