Beberapa Minggu yang lalu saya Meng-Upgrade Component VB 2008 Express Edition yang ter-install di CPU saya dengan menambahkan Componnent VB6. Ternyata penggunaan perintah scriptnya sangat berbeda ketika kita menggunakan componnent tersebut pada Plat Form VB 2008 Express Edition, demikian juga pada Plat Form VB 6.0. Saya biasanya menggunakan VB 6.0 dan VB 2008 Express Edition. Saya akan membandingkan penggunaan Componnent VB6 pada Plat Form VB 2008 Express Edition dengan component VB 2008 Itu Sendiri, Component object ToolBox yang digunakan sama. Saya akan menampilkan penggunakan fungsi Drawline pada PictureBox.
Perhatikan Tabel ToolBox yang saya gunakan di bawah ini:
Component ToolBox VB6 pada Plat Form VB 2008 Express Edition.
Component ToolBox VB6 pada Plat Form VB 2008 Express Edition.
1 UserForm | Name: Form1 Text: Graphic VB6 Component Vs VB 2008 |
1 PictureBox | Name: PictureBox1 |
1 Button | Name:Button1 Text: View Graphic |
Component ToolBox VB 2008 Express Edition.
1 UserForm | Name: Form1 Text: V. Hutabalian's Blog VB6 Vs VB 2008 |
1 PictureBox | Name: PictureBox1 |
1 Button | Name:Button1 Text: View Graphic |
Desain Form ToolBox yang digunakan sama untuk kedua-duanya.
Desain componnent VB6 pada Plat Form VB 2008 Express Edition:
Desain componnent VB 2008 Express Edition:
Setelah mendesain Toolbox dan mengatur semua propertisnya, maka ketikkan Source program di bawah ini:
Script untuk menggunakan componnent ToolBox VB6 pada Plat Form VB 2008 Express Edition:
Script untuk menggunakan componnent ToolBox VB6 pada Plat Form VB 2008 Express Edition:
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++'
'Create Drawline Function VB6 componnent in VB 2008 Express Edition'
'======================================================================='
' Berbagi ilmu Sensasi Kepuasan Tersendiri '
' Visual Programming by: Verynandus Hutabalian'
' Publish to V. Hutabalian's Blog 26 September 2010 '
'+++++++++++++++++++++++========================++++++++++++++++++++++++'
Option Strict Off
Public Class Form1
Private Sub InitializeComponent()
Me.VB6PictureBox1 = New CodeArchitects.VB6Library.VB6PictureBox
Me.VB6CommandButton1 = New CodeArchitects.VB6Library.VB6CommandButton
Me.SuspendLayout()
'
'VB6PictureBox1
'
Me.VB6PictureBox1.AutoSize = True
Me.VB6PictureBox1.BackColor = System.Drawing.Color.Black
Me.VB6PictureBox1.Location = New System.Drawing.Point(58, 34)
Me.VB6PictureBox1.Name = "VB6PictureBox1"
Me.VB6PictureBox1.ScaleHeight = 1066.667!
Me.VB6PictureBox1.ScaleMode = CodeArchitects.VB6Library.VBRUN.ScaleModeConstants.vbUser
Me.VB6PictureBox1.ScaleWidth = 1354.667!
Me.VB6PictureBox1.Size = New System.Drawing.Size(254, 200)
Me.VB6PictureBox1.TabIndex = 0
'
'VB6CommandButton1
'
Me.VB6CommandButton1.Location = New System.Drawing.Point(135, 244)
Me.VB6CommandButton1.Name = "VB6CommandButton1"
Me.VB6CommandButton1.Size = New System.Drawing.Size(100, 47)
Me.VB6CommandButton1.TabIndex = 1
Me.VB6CommandButton1.Text = "View Graphic" & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10)
Me.VB6CommandButton1.UseVisualStyleBackColor = True
'
'Form1
'
Me.ClientSize = New System.Drawing.Size(376, 303)
Me.Controls.Add(Me.VB6CommandButton1)
Me.Controls.Add(Me.VB6PictureBox1)
Me.Name = "Form1"
Me.Text = "Graphic VB6 Component Vs VB 2008 "
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Private Sub VB6CommandButton1_Click() Handles VB6CommandButton1.Click
Dim Xvalue() As Integer = {100, 400, 400, 100}
Dim Yvalue() As Integer = {100, 400, 100, 400}
VB6PictureBox1.Line(CodeArchitects.VB6Library.VBRUN.GraphicsOptions.None, Xvalue(0), Yvalue(0), Xvalue(1), Yvalue(1), QBColor(11))
VB6PictureBox1.Line(CodeArchitects.VB6Library.VBRUN.GraphicsOptions.None, Xvalue(2), Yvalue(2), Xvalue(3), Yvalue(3), QBColor(11))
End Sub
End Class
Script untuk menggunakan componnent ToolBox VB 2008 Express Edition:
Public Class Form1
Inherits System.Windows.Forms.Form
Dim gobj As System.Drawing.Graphics
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
gobj = PictureBox1.CreateGraphics
Dim Xvalue() As Integer = {10, 40, 40, 10}
Dim Yvalue() As Integer = {10, 40, 10, 40}
Dim pen As New Pen(Color.Blue, 2) ' creates a pen instance
gobj.DrawLine(pen, Xvalue(0), Yvalue(0), Xvalue(1), Yvalue(1))
gobj.DrawLine(pen, Xvalue(2), Yvalue(2), Xvalue(3), Yvalue(3))
End Sub
End Class
Setelah itu untuk menampilkan hasilnya tekan F5, lalu tekan tombol View Graphic.
Tampilan hasil penggunaan componnent VB6 pada Plat Form VB 2008 Express Edition:
Tampilan hasil penggunaan componnent VB6 pada Plat Form VB 2008 Express Edition:
Tampilan hasil penggunaan componnent VB 2008 Express Edition:
Untuk pengembangan aplikasi yang lebih kompleks, Anda bisa mengembangkan dengan menggali kreatifitas Anda sendiri. Semoga bermanfaat.
Selamat mencoba Guys! Nantikan Tips Aplikasi Cantik Lainnya by Verynandus Hutabalian.
Selamat mencoba Guys! Nantikan Tips Aplikasi Cantik Lainnya by Verynandus Hutabalian.
0 komentar:
Posting Komentar