개인 코드 라이브러리의 데스크톱 가장자리 자동 접착
17650 단어 코드
using
System.Windows.Forms;
using
System;
namespace
**
{
public
partial
class
***
: form
{
/*
【 】:
* No.1: Move 。
* No.2: MouseEnter 。
* No.3:MouseLeave 。 “deactivated” + [ ]leave 。
* “**” namespace。
*/
int
intBianYuanXiangSu
=
7
;
//
。 , , 。
///
<summary>
///
。
///
</summary>
///
<param name="intJingDu">
, 10 。
</param>
///
<param name="LeftRight">
。
</param>
private
void
myMethod_AutoAbsorb(
int
intJingDu ,
bool
LeftAndRight)
{
//
10 . 10 。
if
( intJingDu
<=
10
)
intJingDu
=
10
;
//
! ! , 。
if
( Left
!=
SystemInformation.WorkingArea.Width
-
this
.Size.Width
&&
Left
!=
0
&&
Top
!=
0
)
{
//
" " , 。
if
( Location.Y
<=
intJingDu
&&
Location.Y
>
-
this
.Size.Height
+
intBianYuanXiangSu )
Top
=
0
;
if
( LeftAndRight
==
true
)
{
//
" " , 。
if
(
this
.Location.X
<=
intJingDu
&&
Location.X
>
-
Size.Width
+
intBianYuanXiangSu )
Left
=
0
;
//
“ ” , 。WorkingArea 。
if
( Location.X
>=
( SystemInformation.WorkingArea.Width
-
this
.Size.Width
-
intJingDu )
&&
Left
<
SystemInformation.WorkingArea.Width
-
intBianYuanXiangSu )
Left
=
SystemInformation.WorkingArea.Width
-
Size.Width;
}
}
}
private
void
myMethod_AutoAbsorb_MouseEnter()
{
if
( Top
==
-
this
.Size.Height
+
intBianYuanXiangSu )
//
this
.Top
=
0
;
if
( Left
==
-
this
.Size.Width
+
intBianYuanXiangSu )
//
this
.Left
=
0
;
if
( Left
==
SystemInformation.WorkingArea.Width
-
intBianYuanXiangSu )
//
this
.Left
=
SystemInformation.WorkingArea.Width
-
this
.Size.Width;
}
//
deactivated + leave 。 。
private
void
myMethod_AutoAbsorb_MouseLeave()
{
//
, 。
if
(
!
( ( Control.MousePosition.X
>=
Left
&&
Control.MousePosition.X
<=
Left
+
Width )
&&
( Control.MousePosition.Y
>=
Top
&&
Control.MousePosition.Y
<=
Top
+
Height ) ) )
{
if
( Top
==
0
)
//
Top
=
-
Size.Height
+
intBianYuanXiangSu;
if
( Left
==
0
)
//
Left
=
-
Size.Width
+
intBianYuanXiangSu;
if
( Left
==
SystemInformation.WorkingArea.Width
-
Size.Width )
//
Left
=
SystemInformation.WorkingArea.Width
-
intBianYuanXiangSu;
}
}
}
}
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
vue 단일 페이지에 여러 개의 echarts 도표가 있을 때의 공용 코드 쓰기html에서: 데이터 처리는 말할 필요가 없다.응, 직접 그림을 그려: 공통 섹션: 이 페이지를 떠날 때 파괴: 추가 정보: Vue + Echarts 차트 표시 및 동적 렌더링 준비 작업 echarts 의존 설치 n...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.