Public Class Form1
Dim R As Integer
Dim G As Integer
Dim B As Integer
Dim A As Integer
Private Sub TrackBar1_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar1.Scroll
PictureBox4.BackColor = Color.FromArgb(TrackBar1.Value, TrackBar2.Value, TrackBar3.Value)
Label1.Text = TrackBar1.Value
PictureBox1.BackColor = Color.FromArgb(TrackBar1.Value, 0, 0)
End Sub
Private Sub TrackBar2_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar2.Scroll
PictureBox4.BackColor = Color.FromArgb(TrackBar1.Value, TrackBar2.Value, TrackBar3.Value)
Label2.Text = TrackBar2.Value
PictureBox2.BackColor = Color.FromArgb(0, TrackBar2.Value, 0)
End Sub
Private Sub TrackBar3_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar3.Scroll
PictureBox4.BackColor = Color.FromArgb(TrackBar1.Value, TrackBar2.Value, TrackBar3.Value)
Label3.Text = TrackBar3.Value
PictureBox3.BackColor = Color.FromArgb(0, 0, TrackBar3.Value)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
R = val(InputBox("請輸入紅色", "紅", 128))
G = val(InputBox("請輸入綠色", "綠", 128))
B = val(InputBox("請輸入藍色", "藍", 128))
TrackBar1.Value = R
TrackBar2.Value = G
TrackBar3.Value = B
PictureBox4.BackColor = Color.FromArgb(R, G, B)
Label1.Text = R
PictureBox1.BackColor = Color.FromArgb(R, 0, 0)
Label2.Text = G
PictureBox2.BackColor = Color.FromArgb(0, G, 0)
Label3.Text = B
PictureBox3.BackColor = Color.FromArgb(0, 0, B)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
R = Val(TextBox1.Text)
G = Val(TextBox2.Text)
B = Val(TextBox3.Text)
TrackBar1.Value = R
TrackBar2.Value = G
TrackBar3.Value = B
PictureBox4.BackColor = Color.FromArgb(R, G, B)
Label1.Text = R
PictureBox1.BackColor = Color.FromArgb(R, 0, 0)
Label2.Text = G
PictureBox2.BackColor = Color.FromArgb(0, G, 0)
Label3.Text = B
PictureBox3.BackColor = Color.FromArgb(0, 0, B)
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
R = TrackBar1.Value
G = TrackBar2.Value
B = TrackBar3.Value
A = MsgBox("您的色彩有" + " 紅色=" & R & " 綠色=" & G & " 藍色=" & B, MsgBoxStyle.YesNo + MsgBoxStyle.Information, "調色盤")
End Sub
End Class
愛妳喔
回覆刪除我也愛你
刪除神愛世人
刪除