Visualizzazione dei risultati da 1 a 6 su 6

Discussione: [VB6] Pulsanti rotondi

  1. #1
    Utente di HTML.it
    Registrato dal
    Jan 2004
    Messaggi
    129

    [VB6]pulsanti rotondi

    premetto che sono abbastanza nuovo nel mondo della programmazione ma me la cavo.

    volevo fare una domanda è possibile mettere dei pulsanti rotondi in un form? se si come? esistono dei siti dove ci sono pulsanti o temi dei form da scaricare gratuitamente ciao grazie 1000

  2. #2
    Utente di HTML.it L'avatar di Brainjar
    Registrato dal
    Nov 2004
    Messaggi
    1,162
    Te li puoi creare da te.
    Utilizza delle bitmap (o delle gif) che riproducono il
    bottone nei suoi stati.
    Per cominciare potresti utilizzare due gif. Una per il tasto
    'a riposo' ed una per il tasto 'premuto'.
    Le gif sono visualizzate in altrettante picturebox.
    Visualizza il tasto a riposo e sull' evento MouseDown della
    picture visualizzi il tasto 'premuto'.
    Nell'evento MouseUp rivisualizzi il tasto a riposo e gestisci
    e lanci le operazioni che normalmente lanceresti nell'evento
    Click di un bottone generico.

    Se sei mediamente esperto, potresti crearti un OCX.
    Ciao, Brainjar

  3. #3
    Utente di HTML.it
    Registrato dal
    Jan 2004
    Messaggi
    129
    grazie 1000 per la risposta . esistono delle OCX free da scaricare? cosi' inizio a utilizzare anche questi componenti a me ancora nuovi? ciao grazie 1000

  4. #4
    Utente di HTML.it L'avatar di Brainjar
    Registrato dal
    Nov 2004
    Messaggi
    1,162
    Credo di si, ma se sono compilati e senza sorgente, sei punto e a
    capo.
    Ciao, Brainjar

  5. #5
    Utente di HTML.it L'avatar di Boolean
    Registrato dal
    Oct 2005
    Messaggi
    758
    ciao fux_vr

    ho realizzato un piccolissimo ocx di un pulsante rotondo...
    questo è il codice del controllo, devi copiarlo in un file di testo creato con il notepad, e rinominarlo in RoundButton.ctl, poi caricalo come controllo utente in un progetto VB6

    codice:
    VERSION 5.00
    Begin VB.UserControl RoundButton 
       BackStyle       =   0  'Transparent
       ClientHeight    =   1500
       ClientLeft      =   0
       ClientTop       =   0
       ClientWidth     =   1515
       ScaleHeight     =   1500
       ScaleWidth      =   1515
       Begin VB.Label lblcaption 
          Alignment       =   2  'Center
          AutoSize        =   -1  'True
          BackStyle       =   0  'Transparent
          Caption         =   "Label1"
          Height          =   195
          Left            =   495
          TabIndex        =   0
          Top             =   630
          Width           =   480
       End
       Begin VB.Shape shpArea 
          BackStyle       =   1  'Opaque
          Height          =   1215
          Left            =   120
          Shape           =   2  'Oval
          Top             =   120
          Width           =   1230
       End
    End
    Attribute VB_Name = "RoundButton"
    Attribute VB_GlobalNameSpace = False
    Attribute VB_Creatable = True
    Attribute VB_PredeclaredId = False
    Attribute VB_Exposed = False
    Dim act_ClickColor
    Dim act_BackColor
    Dim act_BorderColor
    
    Public Event Click()
    Public Event MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Public Event MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Public Event MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    
    
    Private Sub UserControl_InitProperties()
    Caption = Ambient.DisplayName
    ClickColor = &HDDDDDD
    BorderColor = &H0&
    BackColor = &HFFFFFF
    End Sub
    
    Private Sub UserControl_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    shpArea.BackColor = ClickColor
    RaiseEvent MouseDown(Button, Shift, X, Y)
    End Sub
    
    Private Sub UserControl_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    RaiseEvent MouseMove(Button, Shift, X, Y)
    End Sub
    
    Private Sub UserControl_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    shpArea.BackColor = BackColor
    RaiseEvent MouseUp(Button, Shift, X, Y)
    RaiseEvent Click
    End Sub
    Private Sub lblCaption_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    shpArea.BackColor = ClickColor
    RaiseEvent MouseDown(Button, Shift, lblcaption.Left + X, lblcaption.Top + Y)
    End Sub
    
    Private Sub lblCaption_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    shpArea.BackColor = BackColor
    RaiseEvent MouseUp(Button, Shift, lblcaption.Left + X, lblcaption.Top + Y)
    RaiseEvent Click
    End Sub
    
    Private Sub lblcaption_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    RaiseEvent MouseMove(Button, Shift, lblcaption.Left + X, lblcaption.Top + Y)
    End Sub
    
    Private Sub UserControl_Resize()
    shpArea.Move 0, 0, ScaleWidth, ScaleHeight
    lblcaption.Move (ScaleWidth - lblcaption.Width) / 2, (ScaleHeight - lblcaption.Height) / 2
    End Sub
    
    Property Let Caption(ByVal NewCaption As String)
    lblcaption.Caption = NewCaption
    UserControl_Resize
    End Property
    
    Property Get Caption() As String
    Caption = lblcaption.Caption
    End Property
    
    Property Let BackColor(ByVal NewColor As OLE_COLOR)
    shpArea.BackColor = NewColor
    act_BackColor = NewColor
    PropertyChanged "BackColor"
    End Property
    
    Property Get BackColor() As OLE_COLOR
    BackColor = act_BackColor
    End Property
    
    Property Let BorderColor(ByVal NewColor As OLE_COLOR)
    shpArea.BorderColor = NewColor
    act_BorderColor = NewColor
    PropertyChanged "BorderColor"
    End Property
    
    Property Get BorderColor() As OLE_COLOR
    BorderColor = act_BorderColor
    End Property
    
    Property Let ClickColor(ByVal NewColor As OLE_COLOR)
    act_ClickColor = NewColor
    PropertyChanged "ClickColor"
    End Property
    
    Property Get ClickColor() As OLE_COLOR
    ClickColor = act_ClickColor
    End Property
    
    Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
    BackColor = PropBag.ReadProperty("BackColor", &HFFFFFF)
    BorderColor = PropBag.ReadProperty("BorderColor", &H0&)
    ClickColor = PropBag.ReadProperty("ClickColor", &HDDDDDD)
    Caption = PropBag.ReadProperty("Caption", Ambient.DisplayName)
    End Sub
    
    Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
    PropBag.WriteProperty "BackColor", act_BackColor, &HFFFFFF
    PropBag.WriteProperty "BorderColor", act_BorderColor, &H0&
    PropBag.WriteProperty "ClickColor", act_ClickColor, &HDDDDDD
    PropBag.WriteProperty "Caption", lblcaption.Caption, Ambient.DisplayName
    End Sub
    ovviamente le caratteristiche che ha sono molto scarne, ma puoi personalizzarlo a piacere.
    attualmente è possibile impostare il colore di fondo, del bordo, e il colore che assume il pulsante al click.

    se hai problemi, fammi sapere

    Boolean

  6. #6
    Utente di HTML.it
    Registrato dal
    Jan 2004
    Messaggi
    129
    grazie 1000 molto gentile ...

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.