ACTIVE X CONTROL VB 6.0

Bingung harus post apa ???
ya sudah ni saya membuat sebuah control active x untuk sebuah jam digital berikut adalah langkah-langkah dalam pembuatannya :
Jalankan terlebih dahulu Visual basic 6.0 nya donkk okk
silahkan anda pilih active x control/klik open



setelah itu anda drag satu buah label dan juga satu buah timer !
dan setelah itu anda drag sebuah label dan juga sebuah timer kemudian setinglah beberapa property nya sebagai berikut :
  • name : labeljam 
  • caption : 00:00:00
  • dan property laiinya sesuai keinginan anda 
setelah itu
anda set timernya :
  • name : timerjam
  • interval : 1000

apabila semua sudah anda set perkecilah form nya lihat gambar di bawah ini !



lalu berikut adalah source code nya 

Public Property Set font(ByVal newfont As font)
Set Labeljam.Caption = newfont
PropertyChanged "font"
End Property
Public Property Get font() As font
Set font = Labeljam.font
End Property
Public Event changed()
Private Sub settime(ByVal waktu As String)
Labeljam.Caption = waktu
RaiseEvent changed
End Sub

Private Sub Timerjam_Timer()
Dim jam
jam = Time()
Labeljam.Caption = jam
End Sub
Private Sub UserControl_Initialize()
Labeljam.Caption = Time
Timerjam.Enabled = True
End Sub

Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
Labeljam.font = PropBag.ReadProperty("font", Ambient.font)
Labeljam.FontBold = PropBag.ReadProperty("fontbold", Ambient.font.Bold)
Labeljam.FontSize = PropBag.ReadProperty("fontsize", Ambient.font.Size)
End Sub

Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
Call PropBag.WriteProperty("font", Labeljam.font, Ambient.font)
Call PropBag.WriteProperty("fontbold", Labeljam.FontBold, Ambient.font.Bold)
Call PropBag.WriteProperty("fontsize", Labeljam.FontSize, Ambient.font.Size)
End Sub


apabila sudah selesai silahkan anda priview dan lihat hasil nya ini dia IE akan secara otomatis terbuka lihat gambar di bawah ini :

No comments:

Post a Comment