Visualizzazione dei risultati da 1 a 3 su 3

Discussione: OCX e prprietà Font

  1. #1
    Utente di HTML.it
    Registrato dal
    Oct 2002
    Messaggi
    271

    OCX e prprietà Font

    Salve a tutti,
    Sto realizzando un OCX per implementare un commandButton con qualche funzione in più. (premetto che è il mio primo OCX)
    Vorrei aggiungere la proprietà Font al mio controllo. Questo è quello che ho scritto:

    codice:
    Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
    ....
      CapFont = PropBag.ReadProperty("CaptionFont", Ambient.Font)
    ....
    
    Public Property Get CaptionFont() As StdFont
      Set CaptionFont = CapFont
    End Property
    
    Public Property Set CaptionFont(ByVal vNewValue As StdFont)
      
      CapFont.Name = vNewValue.Name
      CapFont.Bold = vNewValue.Bold
      CapFont.Italic = vNewValue.Italic
      CapFont.Size = vNewValue.Size
      CapFont.Underline = vNewValue.Underline
      CapFont.Strikethrough = vNewValue.Strikethrough
      AggiornaCaption
      PropertyChanged "CaptionFont"
    
    End Property
    Ma in questo modo riesco a cambiare solo il fontName e non cambiano le proprietà Bold, Italic, Size ....

    Qualcuno saprebbe aiutarmi??

  2. #2
    CapFont è una variabile oggetto, devi impostarla con il set (altrimenti ti ritorna il suo value che è il nome del font )

    codice:
    Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
    ....
      Set CapFont = PropBag.ReadProperty("CaptionFont", Ambient.Font)
    ....

  3. #3
    Utente di HTML.it
    Registrato dal
    Oct 2002
    Messaggi
    271
    Grazie! Funziona!!!
    Avevo già provato con il set ma non andava.... forse avevo cambiato qlcs nelle altre routine e avevo dimenticato poi di aggiustarlo.
    Cmq ora va bene. Grazie

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.