Visualizzazione dei risultati da 1 a 2 su 2
  1. #1

    [VB6] Form con bordi arrotondati

    Posso creare una form con i bordi arrotondati?
    Se non si può esiste un'alternativa?
    Oppure posso mettere lo sfondo trasparente nella form?
    Grz
    evilsaint

  2. #2
    Utente di HTML.it L'avatar di LMondi
    Registrato dal
    Sep 2004
    Messaggi
    1,291
    Per dare la trasparenza alla form puoi usare la seguente funzione da inserire in un modulo bas:
    codice:
    Option Explicit
    
    Private Const GWL_EXSTYLE = (-20)
    Private Const LWA_ALPHA = &H2
    Private Const WS_EX_LAYERED = &H80000
    
    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 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
    '------------------------------------------------------------------
    Public Sub FormFade(ByRef frmForm As Form, ByVal Opacity As Long)
        Dim Msg As Long
        frmForm.Show vbModeless
        Msg = GetWindowLong(frmForm.hwnd, GWL_EXSTYLE)
        Msg = Msg Or WS_EX_LAYERED
        SetWindowLong frmForm.hwnd, GWL_EXSTYLE, Msg
        SetLayeredWindowAttributes frmForm.hwnd, 0, Opacity, LWA_ALPHA
        frmForm.Refresh
    End Sub
    Poi nel modulo della form la richiami così:
    codice:
    Option Explicit
    Private Sub Form_Load()
        Dim t As Single
        
    ' Imposta BorderStyle=0
    ' Livello di trasparenza:
        t = 200     ' da 0 a 255
        FormFade Form1, t
    
    End Sub
    LM

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.