728x90
반응형
728x170
▶ MainForm.cs
using System;
using System.Drawing;
using System.Windows.Forms;
namespace TestProject
{
/// <summary>
/// 메인 폼
/// </summary>
public partial class MainForm : Form
{
//////////////////////////////////////////////////////////////////////////////////////////////////// Field
////////////////////////////////////////////////////////////////////////////////////////// Private
#region Field
/// <summary>
/// 복구 사각형
/// </summary>
private Rectangle restoreRectangle;
#endregion
//////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 생성자 - MainForm()
/// <summary>
/// 생성자
/// </summary>
public MainForm()
{
InitializeComponent();
this.mouseLimitCheckBox.CheckedChanged += mouseLimitCheckBox_CheckedChanged;
}
#endregion
//////////////////////////////////////////////////////////////////////////////////////////////////// Method
////////////////////////////////////////////////////////////////////////////////////////// Private
#region 마우스 제한 체크 박스 체크 변경시 처리하기 - mouseLimitCheckBox_CheckedChanged(sender, e)
/// <summary>
/// 마우스 제한 체크 박스 체크 변경시 처리하기
/// </summary>
/// <param name="sender">이벤트 발생자</param>
/// <param name="e">이벤트 인자</param>
private void mouseLimitCheckBox_CheckedChanged(object sender, EventArgs e)
{
if(this.mouseLimitCheckBox.Checked)
{
this.restoreRectangle = Cursor.Clip;
Cursor = new Cursor(Cursor.Current.Handle);
Cursor.Position = new Point
(
Location.X + this.mouseLimitLabel.Location.X,
Location.Y + this.mouseLimitLabel.Location.Y
);
Point startPoint = new Point
(
Location.X + this.mouseLimitLabel.Location.X + 7,
Location.Y + this.mouseLimitLabel.Location.Y + 30
);
Cursor.Clip = new Rectangle(startPoint, this.mouseLimitLabel.Size);
}
else
{
Cursor.Clip = this.restoreRectangle;
}
}
#endregion
}
}
728x90
반응형
그리드형(광고전용)
'C# > WinForm' 카테고리의 다른 글
[C#/WINFORM] 크로미엄 브라우저 사용하기 (0) | 2020.02.28 |
---|---|
[C#/WINFORM] Form 클래스 : CreateParams 속성을 사용해 포커스 설정 방지하기 (0) | 2020.02.12 |
[C#/WINFORM] 멀티 원격 데스크톱 프로토콜 클라이언트(Remote Desktop Protocol Client) 사용하기 (0) | 2020.02.10 |
[C#/WINFORM] GIF 에디터 사용하기 (0) | 2020.01.28 |
[C#/WINFORM] Control 클래스 : MousePosition 정적 속성을 사용해 마우스 위치 색상 구하기 (0) | 2020.01.26 |
[C#/WINFORM] GroupBox 클래스 : 익스팬더(Expander) 그룹 박스 사용하기 (0) | 2020.01.10 |
[C#/WINFORM] ScrollableControl 클래스 : 접을 수 있는 패널 사용하기 (0) | 2020.01.05 |
[C#/WINFORM] UserControl 클래스 : 푯말 레이블 사용하기 (0) | 2019.12.28 |
[C#/WINFORM] UserControl 클래스 : 체크 버튼 사용하기 (0) | 2019.12.28 |
[C#/WINFORM] Label 클래스 : 외곽선 텍스트 사용하기 (0) | 2019.12.27 |
댓글을 달아 주세요