Primera parte de ejemplo de como hacer nuestros propios botones personalizados, que se crean con clases especiales o personalizadas o creadas por nosotros mismo.
Clase contacto
' gambas class file
'by postapase
'primera parte de clase personalizada
Property Nombre As String
Property Movil As String
Private $Nombre As String
Private $Movil As String
Private $CajaPrincipal As Panel
Private $CajaNombre As Label
Private $CajaMovil As Label
Private $Contenedor As ScrollView
Private $observador As Observer
Public Sub _new(nombre As String, movil As String, contenedor As ScrollView)
$Nombre = nombre
$Movil = movil
$Contenedor = contenedor
$CajaPrincipal = New Panel($Contenedor) As "CajaPrincipal"
$CajaPrincipal.Height = 70
$CajaPrincipal.Background = Color.DarkCyan
$CajaPrincipal.Visible = True
$CajaPrincipal.Arrangement = Arrange.Vertical
$CajaPrincipal.Padding = 2
$CajaPrincipal.Border = Border.Solid
$CajaNombre = New Label($CajaPrincipal)
$CajaNombre.Height = 55
$CajaNombre.Visible = True
$CajaNombre.Font.Bold = True
$CajaNombre.Font.Size = 20
$CajaNombre.Alignment = Align.TopLeft
$CajaNombre.Text = $Nombre
$CajaNombre.Expand = True
$CajaNombre.Proxy = $CajaPrincipal
$CajaMovil = New Label($CajaPrincipal)
$CajaMovil.Height = $Contenedor.Height - $CajaPrincipal.Height
$CajaMovil.Visible = True
$CajaMovil.Alignment = Align.Right
$CajaMovil.Text = $Movil
$CajaMovil.Font.Size = 14
$CajaMovil.Font.Italic = True
$CajaMovil.Expand = True
$CajaMovil.Background = Color.Gray
End
Public Sub CajaPrincipal_Enter()
$CajaPrincipal.Background = Color.Cyan
End
Public Sub CajaPrincipal_Leave()
$CajaPrincipal.Background = Color.DarkCyan
End
Private Function Nombre_Read() As String
Return $Nombre
End
Private Sub Nombre_Write(Value As String)
$Nombre = Value
End
Private Function Movil_Read() As String
Return $Movil
End
Private Sub Movil_Write(Value As String)
$Movil = Value
End
Formulario.
Public Sub Button1_Click()
Dim XContacto As Contacto
If txtContacto.Text = Null Then
Return
Else If txtTelefono.Text = Null Then
Return
Endif
XContacto = New Contacto(txtContacto.Text, txtTelefono.Text, ScrollView1)
txtContacto.Clear()
txtTelefono.Clear()
txtContacto.SetFocus()
End
Dim XContacto As Contacto
If txtContacto.Text = Null Then
Return
Else If txtTelefono.Text = Null Then
Return
Endif
XContacto = New Contacto(txtContacto.Text, txtTelefono.Text, ScrollView1)
txtContacto.Clear()
txtTelefono.Clear()
txtContacto.SetFocus()
End
Código fuente
No hay comentarios.:
Publicar un comentario