Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
HScrollBar1.Minimum = 20
HScrollBar1.Maximum = 200
VScrollBar1.Minimum = 30
VScrollBar1.Maximum = 200
Label1.Text = "(" & VScrollBar1.Value & "," & HScrollBar1.Value & ")"
Label1.Location = New Point(HScrollBar1.Value, VScrollBar1.Value)
End Sub
Private Sub HScrollBar1_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles HScrollBar1.Scroll
Label1.Text = "(" & VScrollBar1.Value & "," & HScrollBar1.Value & ")"
Label1.Location = New Point(HScrollBar1.Value, VScrollBar1.Value)
End Sub
Private Sub VScrollBar1_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles VScrollBar1.Scroll
Label1.Text = "(" & VScrollBar1.Value & "," & HScrollBar1.Value & ")"
Label1.Location = New Point(HScrollBar1.Value, VScrollBar1.Value)
End Sub
End Class
* HScroll, VScroll 콘트롤을 폼에 사용하여 이동에 따른 변화된 값을 이용할수 있다
Private Sub HScrollBar1_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles HScrollBar1.Scroll f_Size = HScrollBar1.Value Dim myfont As New Font("Sans Serif", f_Size, FontStyle.Regular) Label1.Font = myfont Label2.Text = "글자 크기는 : " & f_Size & " 입니다" End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Button1.Height = 10 Button1.Width = 10 HScrollBar1.Minimum = 10 HScrollBar1.Maximum = 300 VScrollBar1.Minimum = 10 VScrollBar1.Maximum = 300
End Sub
Private Sub HScrollBar1_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles HScrollBar1.Scroll Button1.Height = HScrollBar1.Value Label1.Text = "버튼의 크기는 (" & HScrollBar1.Value & "," & VScrollBar1.Value & ") 입니다" End Sub
Private Sub VScrollBar1_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles VScrollBar1.Scroll Button1.Width = VScrollBar1.Value Label1.Text = "버튼의 크기는 (" & HScrollBar1.Value & "," & VScrollBar1.Value & ") 입니다" End Sub
Public Class Form1
Dim f_Size As Integer
Private Sub HScrollBar1_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles HScrollBar1.Scroll
f_Size = HScrollBar1.Value
Dim myfont As New Font("Sans Serif", f_Size, FontStyle.Regular)
Label1.Font = myfont
Label2.Text = "글자 크기는 : " & f_Size & " 입니다"
End Sub
End Class
* 활용예제 입니다
* 스크롤 하면 글자 크기가 변합니다
* 소스파일 : 20140105-HScroll.zip
이 댓글을
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Button1.Height = 10
Button1.Width = 10
HScrollBar1.Minimum = 10
HScrollBar1.Maximum = 300
VScrollBar1.Minimum = 10
VScrollBar1.Maximum = 300
End Sub
Private Sub HScrollBar1_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles HScrollBar1.Scroll
Button1.Height = HScrollBar1.Value
Label1.Text = "버튼의 크기는 (" & HScrollBar1.Value & "," & VScrollBar1.Value & ") 입니다"
End Sub
Private Sub VScrollBar1_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles VScrollBar1.Scroll
Button1.Width = VScrollBar1.Value
Label1.Text = "버튼의 크기는 (" & HScrollBar1.Value & "," & VScrollBar1.Value & ") 입니다"
End Sub
End Class
* 활용예제2 입니다
* 스크롤하면 버튼의 크기가 변합니다
* 소스파일 : 20140113-V_HScroll.zip
이 댓글을