/// <summary>
/// 주어진 위치가 어떤 요일인지 구함
/// </summary>
/// <param name="xCursor">커서의 X좌표</param>
/// <returns>
/// [요일]
/// - 0 : 일요일
/// - 1 : 월요일
/// - 2 : 화요일
/// - 3 : 수요일
/// - 4 : 목요일
/// - 5 : 금요일
/// - 6 : 토요일
/// </returns>
public int GetWeek(int xCursor)
{
int wi = (this.Width - (this.DefaultMargin.Horizontal)) / this.CalendarDimensions.Width;
this.CellWidth = wi / 7;
for (int k = 0; k < this.CalendarDimensions.Width; ++k)
{
for (int i = 0; i < 7; ++i)
{
int left = (this.CellWidth * i) + wi * k;
int right = (this.CellWidth * (i + 1)) + wi * k;
if (left < xCursor && xCursor < right)
return i;
}
}
return -1;
}
예제)
'유용한 정보' 카테고리의 다른 글
[C#] DataGridView 자동 행 번호 생성하는 방법(예제) (0) | 2025.05.05 |
---|---|
[C#] 사용자 정의 이벤트 등록 및 사용 예제 (0) | 2025.04.27 |
Windows 10에서 Visual Studio 6(vc6.0) 설치 방법 (2) | 2025.04.22 |
[MFC] 윈도우 레지스트리의 키 또는 데이터를 읽고 쓰고 삭제하기 (0) | 2025.04.19 |
[C#] 기간 선택하기 (0) | 2025.04.19 |