-
[VB.NET] 부분 화면보호기프로그램 소스/VB.NET 2020. 11. 22. 02:35반응형
[VB.NET] 부분 화면보호기
프로그램 화면 ■ 간략한 설명
프로그램 실행시 전체화면을 노란색으로 칠하고 특정부분만 뒷배경을 볼수 있게함.
투명한 부분은 마우스클릭 드래그로 이동이 가능하고 파란색 부분은 클릭시 투명한 부분을 반 가리는 용도.
■ 예제소스
Imports System.Runtime.InteropServices Private Sub Form1_Disposed(sender As Object, e As EventArgs) Handles Me.Disposed For i As Integer = 1 To 4 GL_X(i) = Controls("P_투명" & i).Location.X GL_Y(i) = Controls("P_투명" & i).Location.Y GL_W(i) = Controls("P_투명" & i).Width GL_H(i) = Controls("P_투명" & i).Height Next 기초설정저장() End Sub Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Dim H As Integer = My.Computer.Screen.WorkingArea.Height Dim W As Integer = My.Computer.Screen.WorkingArea.Width Me.Left = 0 Me.Top = 40 Me.Width = W Me.Height = H - 40 Me.TransparencyKey = Color.Red 기초설정가져오기() For i As Integer = 1 To 4 AddHandler Controls("P_투명" & i).MouseMove, AddressOf FORM_MouseMove AddHandler Controls("P_투명" & i).Move, AddressOf P_투명_Move AddHandler Controls("P_투명" & i).SizeChanged, AddressOf P_투명_SizeChanged AddHandler Controls("P_왼쪽" & i).MouseClick, AddressOf P_MouseClick AddHandler Controls("P_오른쪽" & i).MouseClick, AddressOf P_MouseClick AddHandler Controls("P_위쪽" & i).MouseClick, AddressOf P_MouseClick AddHandler Controls("P_아래쪽" & i).MouseClick, AddressOf P_MouseClick Controls("P_투명" & i).Location = New Point(GL_X(i), GL_Y(i)) Controls("P_투명" & i).Width = GL_W(i) Controls("P_투명" & i).Height = GL_H(i) Next End Sub Private Sub FORM_MouseMove(sender As Object, e As MouseEventArgs) Dim IM_X As Double Dim IM_Y As Double Dim frm As Control = sender Try IM_X = frm.Width - e.X IM_Y = frm.Height - e.Y If IM_X < 10 And IM_Y < 15 Then frm.Cursor = Cursors.SizeNWSE If e.Button = MouseButtons.Left Then frm.Size = New Size(e.Location.X, e.Location.Y) End If Else If IM_X < 15 And IM_Y > 15 Then frm.Cursor = Cursors.SizeWE If e.Button = MouseButtons.Left Then frm.Size = New Size(e.Location.X, frm.Height) End If Else If IM_X > 15 And IM_Y < 15 Then frm.Cursor = Cursors.SizeNS If e.Button = MouseButtons.Left Then frm.Size = New Size(frm.Width, e.Location.Y) End If Else If IM_X > 15 And IM_Y < 15 Then frm.Cursor = Cursors.SizeNS If e.Button = MouseButtons.Left Then frm.Size = New Size(e.Location.X, frm.Height) End If Else If e.Button = MouseButtons.Left Then M_OBJMOVE.MoveObject(sender.Handle) sender.SendToBack() Application.DoEvents() End If frm.Cursor = Cursors.Default End If End If End If End If Catch ex As Exception End Try End Sub Private Sub P_투명_Move(sender As Object, e As EventArgs) Dim 기준X, 기준Y, 기준W, 기준H As Integer 기준X = sender.Location.X 기준Y = sender.Location.Y 기준H = sender.Height 기준W = sender.Width Dim 번호 As String 번호 = sender.name.Replace("P_투명", "") Controls("P_위쪽" & 번호).Location = New Point(기준X, 기준Y - (기준H / 2) + (Controls("P_위쪽" & 번호).Height * 위치상태(번호, 0))) Controls("P_아래쪽" & 번호).Location = New Point(기준X, 기준Y + 기준H - (Controls("P_아래쪽" & 번호).Height * 위치상태(번호, 1))) Controls("P_왼쪽" & 번호).Location = New Point(기준X - (기준W / 2) + (Controls("P_왼쪽" & 번호).Width * 위치상태(번호, 2)), 기준Y) Controls("P_오른쪽" & 번호).Location = New Point(기준X + 기준W - (Controls("P_오른쪽" & 번호).Width * 위치상태(번호, 3)), 기준Y) End Sub Private Sub P_투명_SizeChanged(sender As Object, e As EventArgs) Dim 기준X, 기준Y, 기준W, 기준H As Integer 기준X = sender.Location.X 기준Y = sender.Location.Y 기준H = sender.Height 기준W = sender.Width Dim 번호 As String 번호 = sender.name.Replace("P_투명", "") Controls("P_위쪽" & 번호).Size = New Size(기준W, (기준H / 2)) Controls("P_아래쪽" & 번호).Size = New Size(기준W, (기준H / 2)) Controls("P_위쪽" & 번호).Location = New Point(기준X, 기준Y - (기준H / 2) + (Controls("P_위쪽" & 번호).Height * 위치상태(번호, 0))) Controls("P_아래쪽" & 번호).Location = New Point(기준X, 기준Y + 기준H - (Controls("P_아래쪽" & 번호).Height * 위치상태(번호, 1))) Controls("P_왼쪽" & 번호).Size = New Size((기준W / 2), 기준H) Controls("P_오른쪽" & 번호).Size = New Size((기준W / 2), 기준H) Controls("P_왼쪽" & 번호).Location = New Point(기준X - (기준W / 2) + (Controls("P_왼쪽" & 번호).Width * 위치상태(번호, 2)), 기준Y) Controls("P_오른쪽" & 번호).Location = New Point(기준X + 기준W - (Controls("P_오른쪽" & 번호).Width * 위치상태(번호, 3)), 기준Y) End Sub Dim 위치상태(5, 4) As Integer Private Sub P_MouseClick(sender As Object, e As MouseEventArgs) sender.BringToFront() Dim 기준X, 기준Y, 기준W, 기준H As Integer Dim 번호 As String 번호 = sender.name.Replace("P_왼쪽", "").Replace("P_오른쪽", "").Replace("P_위쪽", "").Replace("P_아래쪽", "") 기준X = Controls("P_투명" & 번호).Location.X 기준Y = Controls("P_투명" & 번호).Location.Y 기준H = Controls("P_투명" & 번호).Height 기준W = Controls("P_투명" & 번호).Width If InStr(sender.name, "P_위쪽") > 0 Or InStr(sender.name, "P_아래쪽") > 0 Then If sender.name = "P_위쪽" Then If 위치상태(번호, 0) = 1 Then 위치상태(번호, 0) = 0 Else 위치상태(번호, 0) = 1 sender.Location = New Point(기준X, 기준Y - Controls("P_오른쪽" & 번호).Height + (sender.Height * 위치상태(번호, 0))) Else If 위치상태(번호, 1) = 1 Then 위치상태(번호, 1) = 0 Else 위치상태(번호, 1) = 1 sender.Location = New Point(기준X, 기준Y + 기준H - (sender.Height * 위치상태(번호, 1))) End If Else If InStr(sender.name, "P_왼쪽") > 0 Then If 위치상태(번호, 2) = 1 Then 위치상태(번호, 2) = 0 Else 위치상태(번호, 2) = 1 sender.Location = New Point(기준X - Controls("P_왼쪽" & 번호).Width + (sender.Width * 위치상태(번호, 2)), 기준Y) Else If 위치상태(번호, 3) = 1 Then 위치상태(번호, 3) = 0 Else 위치상태(번호, 3) = 1 sender.Location = New Point(기준X + 기준W - (sender.Width * 위치상태(번호, 3)), 기준Y) End If End If End Sub
■ 프로그램 설치파일
반응형'프로그램 소스 > VB.NET' 카테고리의 다른 글
[VB.NET] JSON 파싱 (0) 2020.12.03 [VB.NET] 간단한 영수증 출력 예제소스 (0) 2020.11.29 [VB.NET] 비동기 소켓통신(Socket) 서버(Server) (0) 2020.11.27 [VB.NET]AES 암호화 & 복호화 예제소스 (0) 2020.11.24 [VB.NET] Excel파일 PDF전환 소스 (0) 2020.11.21