'### 폼 스티커######################################################
Dim First As Point
Private FormReSizeType As String = "None"
Private MoveMouseX As Integer ' 이동하기전 월래 마우스 X 위치
Private MoveMouseY As Integer ' 이동하기전 월래 마우스 Y 위치
' 위치 기억하기 위한 변수 설정(Panel Mouse_Move 이벤트와 MemoSize함에서 각각 쓰임, Load시 기본셋팅값 현재 위치로 해야 함.)
Dim ReSize_LocationX As Integer = Me.Location.X
Dim ReSize_LocationY As Integer = Me.Location.Y
Dim instance As Graphics
Dim pen As Pen '(color.red, 1)
Dim x As Integer
Dim y As Integer
Private Sub MemoSize()
접속기록(Label100.Text)
If Me.Width = 230 And Me.Height = 25 Then
Me.Width = 951
Me.Height = 689
Me.Padding = New Padding(0, 0, 0, 0)
Dim Sx As Integer = Me.Location.X
Dim Sy As Integer = Me.Location.Y
If Sx > SystemInformation.PrimaryMonitorMaximizedWindowSize.Width - Width Then
Me.Location = New Point(SystemInformation.PrimaryMonitorMaximizedWindowSize.Width - Width - 10, Sy)
End If
Else
Me.Width = 230
Me.Height = 25
Me.Padding = New Padding(0, 0, 0, 0)
'닫혔을때 원래 위치로 돌아가기 위해 저장되어 있던 위치로 돌아감
Me.Location = New Point(ReSize_LocationX, ReSize_LocationY)
End If
End Sub
Private Sub Panel100_MouseDoubleClick(sender As Object, e As MouseEventArgs) Handles Panel100.MouseDoubleClick
MemoSize()
End Sub
Private Sub Panel100_MouseDown(sender As Object, e As MouseEventArgs) Handles Panel100.MouseDown
First = New Point(PointToScreen(e.Location).X - Me.Location.X, PointToScreen(e.Location).Y - Me.Location.Y) '폼의 위치와 현재 마우스 위치의 화면좌표 차를 First에 대입
End Sub
Private Sub Panel100_MouseMove(sender As Object, e As MouseEventArgs) Handles Panel100.MouseMove
If e.Button = Windows.Forms.MouseButtons.Left Then '마우스 왼쪽 버튼을 누르고 있으면
Me.Location = New Point(
PointToScreen(e.Location).X - First.X,
PointToScreen(e.Location).Y - First.Y
) '마우스 위치의 화면좌표에서 First를 뺀 값을 폼의 위치로 지정
'2016.02.25 최성환 : 마우스 이동시 폼 위치를 저장
ReSize_LocationX = Me.Location.X
ReSize_LocationY = Me.Location.Y
End If
End Sub
Private Sub Panel100_MouseUp(sender As Object, e As MouseEventArgs) Handles Panel100.MouseUp
End Sub
Private Sub PictureBox111_Click(sender As Object, e As EventArgs) Handles PictureBox111.Click
ContextMenuStrip1.Show(MousePosition)
End Sub
Private Sub PictureBox100_Click(sender As Object, e As EventArgs) Handles PictureBox100.Click
Me.Close()
End Sub
Private Sub 프로그램열기ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 프로그램열기ToolStripMenuItem.Click
MainCall()
End Sub
Private Sub 축소하기ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 축소하기ToolStripMenuItem.Click
MemoSize()
End Sub
Private Sub 닫기ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 닫기ToolStripMenuItem.Click
Me.Close()
End Sub
Private Sub Label100_Click(sender As Object, e As EventArgs) Handles Label100.Click
End Sub
Private Sub Label100_MouseDoubleClick(sender As Object, e As MouseEventArgs) Handles Label100.MouseDoubleClick
접속기록(Me.Text)
MemoSize()
End Sub
Private Sub Label100_MouseDown(sender As Object, e As MouseEventArgs) Handles Label100.MouseDown
First = New Point(PointToScreen(e.Location).X - Me.Location.X, PointToScreen(e.Location).Y - Me.Location.Y) '폼의 위치와 현재 마우스 위치의 화면좌표 차를 First에 대입
End Sub
Private Sub Label100_MouseMove(sender As Object, e As MouseEventArgs) Handles Label100.MouseMove
If e.Button = Windows.Forms.MouseButtons.Left Then '마우스 왼쪽 버튼을 누르고 있으면
Me.Location = New Point(
PointToScreen(e.Location).X - First.X,
PointToScreen(e.Location).Y - First.Y
) '마우스 위치의 화면좌표에서 First를 뺀 값을 폼의 위치로 지정
' 마우스 이동시 폼 위치를 저장
ReSize_LocationX = Me.Location.X
ReSize_LocationY = Me.Location.Y
End If
End Sub
'###########################################################폼스티커
'VB.net' 카테고리의 다른 글
Form 확대/축소 (0) | 2018.03.30 |
---|---|
특정글자가 포함되어있는 경우의 조건문 (0) | 2018.03.30 |
단어 색칠하기 & 단어강조 (0) | 2018.03.28 |
카운트클릭을 이용한 정렬방법 (0) | 2018.03.19 |
검색(textbox)창 엔터키 입력 (0) | 2018.03.19 |