티스토리 뷰
1: private Point
2: start_p;
3: // 클릭시 마우스 위치
4: private Point
5: end_p;
6: // 마우스 이동할때 위치
7: private bool mouse_move = false; // 마우스가 드레그 상태인지
8: 확인
9: private void button2_MouseMove(object sender, MouseEventArgs e)
10: // 마우스
11: 이동시
12: {
13: Point th; // 마우스의 현재위치를 계산하기 위한 폼의
14: 위치
15: if (mouse_move == true)
16:
17: {
18: th =
19: this.Location;
20: end_p =
21: ((Control)sender).PointToScreen(new Point(e.X,
22: e.Y));
23: Point tmp = new
24: Point((button2.Location.X + (end_p.X - start_p.X)), (button2.Location.Y +
25: (end_p.Y - start_p.Y)));
26: start_p =
27: ((Control)sender).PointToScreen(new Point(e.X,
28: e.Y));
29:
30:
31: button2.Location =
32: tmp;
33: }
34: }
35: private void button2_MouseDown(object sender, MouseEventArgs e)
36: // 마우스로
37: 컨트롤 클릭시
38: {
39: mouse_move =
40: true;
41: start_p = ((Control)sender).PointToScreen(new
42: Point(e.X, e.Y));
43: }
44: private void button2_MouseUp(object sender, MouseEventArgs e)
45: // 컨트롤에서 마우스
46: 놓았을 때
47: {
48: mouse_move = false;
49: }
'Application > C#' 카테고리의 다른 글
XNA를 시작합시다! (0) | 2011.12.31 |
---|---|
Using Cleartype font in Windows Embedded CE (0) | 2010.11.02 |
C# 메세지 처리 (0) | 2010.07.16 |
닷넷에서의 INI 파일 입출력 (0) | 2010.07.15 |
C# Frequently Asked Questions for C++ programmers (0) | 2008.03.18 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- Information Processor
- humor
- 3D Engine
- Life News
- C#
- Web Programming
- Assembly
- 막장로그
- 짤방 및 아이콘
- diary
- win32
- Military
- BadCode
- cartoon
- Tech News
- 프리랜서로 살아남는 법
- WDB
- wallpaper
- USB Lecture
- 나비효과
- medical
- Embedded System
- Battle
- Reverse Engineering
- 야마꼬툰
- Mabinogi
- Network Inspector
- network
- Linux
- console
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 |
글 보관함