Membuat Gradient dengan Visual Basic

Buat form seperti  di  bawah ini🙂

gradientForm

Lalu ketikkan kode berikut pada kode editor.

Option Explicit
Private Sub Form_Resize()
Dim wrnBaru As Long
Dim pixel As Integer, lebar As Integer
Dim merah As Single, hijau As Single, biru As Single, startmerah As Single, starthijau As Single, startbiru As Single
Dim endmerah As Integer, endhijau As Integer, endbiru As Integer

startmerah = 120
endmerah = 220
starthijau = 20
endhijau = 180
startbiru = 189
endbiru = 220

lebar = Form1.ScaleWidth
merah = (endmerah - startmerah) / lebar
hijau = (endhijau - starthijau) / lebar
biru = (endbiru - startbiru) / lebar
For pixel = 0 To lebar - 1
 wrnBaru = RGB(startmerah + merah * pixel, starthijau + hijau * pixel, startbiru + biru * pixel)
 Form1.Line (pixel, 0)-(pixel, Form1.Height - 1), wrnBaru

Next

Run dan hasilnya seperti ini😉

gradientEXE

End Sub

0 Responses to “Membuat Gradient dengan Visual Basic”



  1. Tinggalkan sebuah Komentar

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s




Me (^^)

About

Blog ini adalah catatan kuliah ku, tidak hanya mengenai materi kuliah tetapi juga tentang kegiatan, pengalaman aku selama kuliah :) .


=-=-=-=-=
image header = "Byousoku 5 cm " with edited :)

Liroesdy on Net (=^_^=)

Blog Stats

  • 59,078 hits
Click to view my 

Personality Profile page

My Personal Blog

Liroesdy Blog

Liroesdy Lab

Liroesdy Lab

%d blogger menyukai ini: