Condividi tramite

Form trasparente

Anonimo
2021-02-01T10:27:27+00:00

Ciao, per favore potrei sapere se esiste una modalità per rendere trasparente una form?

Grazie

Microsoft 365 e Office | Access | Per la casa | Windows

Domanda bloccata. Questa domanda è stata eseguita dalla community del supporto tecnico Microsoft. È possibile votare se è utile, ma non è possibile aggiungere commenti o risposte o seguire la domanda.

0 commenti Nessun commento

2 risposte

Ordina per: Più utili
  1. Anonimo
    2021-02-01T13:36:16+00:00

    Ciao Mimmo, come vedi dall'immagine che ho allegato esiste la form e l'immagine che è un suggerimento, vorrei che la maschera non si vedesse e venisse visualizzato solo l'immagine del suggerimento.

    Ho trovato questo codice ma ricevo un errore e non so come risolvere e dirti se funziona.

    Private Sub Form_load()

    Dim Transp As Long

    Transp = RGB(0, 0, 0) 'This is the color you want your background to be

    Me.Detail.BackColor = Transp

    Me.Painting = False

    SetFormOpacity Me, 0.5, Transp

    Me.Painting = True

    End Sub

    Questo invece è il modulo:

    Option Compare Database

    Private Declare PtrSafe Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _

      (ByVal hwnd As Long, _

       ByVal nIndex As Long) As Long

    Private Declare PtrSafe Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _

      (ByVal hwnd As Long, _

       ByVal nIndex As Long, _

       ByVal dwNewLong As Long) As Long

    Private Declare PtrSafe Function SetLayeredWindowAttributes Lib "user32" _

      (ByVal hwnd As Long, _

       ByVal crKey As Long, _

       ByVal bAlpha As Byte, _

       ByVal dwFlags As Long) As Long

    Private Const LWA_ALPHA     As Long = &H2

    Private Const GWL_EXSTYLE   As Long = -20

    Private Const WS_EX_LAYERED As Long = &H80000

    Public Sub SetFormOpacity(frm As Form, sngOpacity As Single, TColor As Long)

        Dim lngStyle As Long

        ' get the current window style, then set transparency

        lngStyle = GetWindowLong(frm.hwnd, GWL_EXSTYLE)

        SetWindowLong frm.hwnd, GWL_EXSTYLE, lngStyle Or WS_EX_LAYERED

        SetLayeredWindowAttributes frm.hwnd, TColor, (sngOpacity * 255), LWA_ALPHA

    End Sub

    La risposta è stata utile?

    0 commenti Nessun commento
  2. domenico laurenza 9,900 Punti di reputazione Moderatore volontario
    2021-02-01T13:03:12+00:00

    Ciao,

    Non è chiaro cosa intendi con trasparente 

    Mimmo

    La risposta è stata utile?

    0 commenti Nessun commento