ColorDialog 기초
*
Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ColorDialog1.ShowDialog()
Me.BackColor = ColorDialog1.Color
End Sub
End Class

""간단"
Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ColorDialog1.ShowDialog()
BackColor = ColorDialog1.Color
End Sub
End Class

이 게시물을

댓글'2'
교교
  • 2013.12.18
  • 수정: 2013.12.18 08:43:20

http://blog.naver.com/PostView.nhn?blogId=lcsco&logNo=120149891632

 

Public Class Form1
    Dim rand As New Random
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim r, g, b As Integer
        r = rand.Next(0, 255)
        g = rand.Next(0, 255)
        b = rand.Next(0, 255)
        Me.BackColor = Color.FromArgb(r, g, b)
    End Sub
End Class

이 댓글을

V닉맨
  • 2013.12.18
  • 수정: 2013.12.18 09:11:24

* 버튼을 클릭 할때마다 랜덤하게 색상 변경

 

Public Class Form1
    Dim r, g, b As Integer
    Dim rand As New Random
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Randomize()
        r = Rand.next(0, 255)
        Randomize()
        g = rand.Next(0, 255)
        Randomize()
        b = rand.Next(0, 255)
        BackColor = Color.FromArgb(r, g, b)
        Label1.Text = "색상값  R :  " + CStr(r) + " / G : " + CStr(g) + " / B : " + CStr(b)
    End Sub

 

이 댓글을

공유하기

SEARCH

MENU NAVIGATION