摘要:[Visual Basic 6.0] 隨機變色的表單 (適合新手學習亂數、畫線)
[Visual Basic 6.0] 隨機變色的表單 (適合新手學習亂數、畫線)
Private Sub Form_Activate() ' 當表單啟動時
Randomize
Picture1.ForeColor = Rnd * 99999
Picture1.Line (0, Picture1.Height / 2 - 500)-(Picture1.Width, Picture1.Height / 2 + 500), , BF
Picture1.ForeColor = Rnd * 99999
Picture1.Line (Picture1.Width / 2 - 500, 0)-(Picture1.Width / 2 + 500, Picture1.Height * 2), , BF
End Sub
我們也可以改成 滑鼠每點一下就更換顏色
Private Sub Picture1_Click()
Picture1.Cls
Randomize
Picture1.ForeColor = Rnd * 99999
Picture1.Line (0, Picture1.Height / 2 - 500)-(Picture1.Width, Picture1.Height / 2 + 500), , BF
Picture1.ForeColor = Rnd * 99999
Picture1.Line (Picture1.Width / 2 - 500, 0)-(Picture1.Width / 2 + 500, Picture1.Height * 2), , BF
End Sub
[Visual Basic 6.0] 隨機變色的表單.rar
#0xDe 從分享中學習
#Facebook:ProgrammerDe (https://www.facebook.com/MicrosoftDes) 有問題歡迎提問