블로그 이미지
Every unexpected event is a path to learning for you.

카테고리

분류 전체보기 (2741)
Unity3D (30)
Programming (475)
Python (8)
TinyXML (5)
STL (13)
D3D (3)
MFC (1)
C/C++ (54)
C++/CLI (45)
C# (250)
WinForm (6)
WPF (5)
Math (10)
A.I. (1)
Win32API (11)
Algorithm (3)
Design Pattern (7)
UML (1)
MaxScript (1)
FMOD (4)
FX Studio (1)
Lua (2)
Terrain (1)
Shader (3)
boost (2)
Xml (2)
JSON (4)
Etc (11)
Monad (1)
Html5 (4)
Qt (1)
Houdini (0)
Regex (11)
Server (33)
Unreal (4)
Gamebryo (56)
Tip & Tech (228)
협업 (58)
3DS Max (3)
Game (12)
Utility (136)
Etc (96)
Link (32)
Portfolio (19)
Subject (90)
iOS,OSX (54)
Android (15)
Linux (5)
잉여 프로젝트 (2)
게임이야기 (3)
Memories (20)
Interest (38)
Thinking (38)
한글 (30)
PaperCraft (5)
Animation (408)
Wallpaper (2)
재테크 (18)
Exercise (3)
나만의 맛집 (3)
냥이 (10)
육아 (16)
Total
Today
Yesterday
05-21 00:43


richTextBox에 클립보드로부터 붙이기를 할 때 rtf 포맷으로 붙이기가 될 때가 있다. 그런데, 지금 하려는

작업이 plain text를 붙여야만 하는 경우여서 구글링해봤으나.. 결국은 속임수를 쓰기로...
방법은 richTextBox에서 Ctrl+V 키보드 이벤트를 가로채서 클립보드의 텍스트만 집어넣는 것이다. 간단?

ㅋㅋ 코드는 다음과 같다.


private void richTextBox1_KeyDown(object sender, KeyEventArgs e)
{
    if ((e.KeyCode == Keys.V) && (e.Modifiers == Keys.Control))
    {
        e.Handled = true;
        richTextBox1.SelectedText = Clipboard.GetText();
    }
}

출처 : 모름 -ㅅ-;;

반응형
Posted by blueasa
, |

Cecil Lew

네트워크 관리 및 워크플로 처리 같은 대부분의 응용 프로그램 유형에는 다이어그램 작성 인터페이스가 필요합니다. 그러나 Windows 응용 프로그램에서 Visio와 같은 다이어그램 작성 인터페이스를 개발하기는 좀처럼 쉬운 일이 아닙니다. 이 기사에서는 Cecil Lew가 UserControl 및 몇 가지 단순한 클래스를 기반으로 하여 간단한 다이어그램 작성 도구를 빌드하는 방법을 소개합니다.

응용 프로그램에서 다이어그램 작성 기능이 필요한 경우에는 어떻게 하시겠습니까? 이 경우 다음과 같은 네 가지 방법이 있습니다. 즉, 1) 타사 라이브러리를 구입하거나 2) Netron 등의 공개 소스 라이브러리를 사용하거나(확장도 가능함) 3) 응용 프로그램을 Visio와 통합하거나 4) 새 도구를 처음부터 빌드하는 것입니다.

1번이 가장 쉽겠지만 타사 지원에 의존해야 하므로 위험도도 가장 높습니다. 2번도 괜찮은 방법 같지만, 개인적으로 이 방법을 사용해 봤는데 솔직히 25,000줄의 코드로 이루어진 다른 사람이 작성한 라이브러리를 확장하는 것은 쉬운 일이 아닙니다. 3번은 Microsoft Office 커뮤니티에서 많은 지원을 받을 수 있으므로 쉽게 수행할 수 있습니다. 그러나 이 경우 응용 프로그램을 통합하려면 대상 컴퓨터에 올바른 버전의 Visio가 설치되어 있어야 한다는 단점이 있습니다. 여기까지 읽으셨다면 제가 개인적으로 4번을 선호한다는 사실을 눈치채셨을 것입니다. Windows Form 및 GDI+에서는 확대/축소, 변환 및 회전 같은 그리기 및 2D 변환에 뛰어난 기능을 제공합니다.

이 기사에서는 이를 검증하기 위해 개발한 간단한 다이어그램 작성 응용 프로그램에 대해 설명합니다. 먼저 클래스 디자인을 중점적으로 설명한 다음 보다 중요한 기능을 자세히 설명합니다. 이 기사에서 설명하는 응용 프로그램은 C# 및 Windows Form을 사용하여 작성되었습니다. 그림 1은 이 응용 프로그램을 보여 줍니다.

그림 1

왼쪽에는 BlockControl 또는 Connector를 오른쪽의 그리기 영역으로 끌어서 놓을 수 있는 도구 상자가 있습니다. 그리고 컨트롤의 텍스트를 두 번 클릭하여 수정할 수 있습니다. 마지막으로 Connector 핸들을 끌어 BlockControl 주위의 핸들 중 하나에 부착할 수 있습니다.

물론 이 응용 프로그램에서 유용한 기능을 많이 제공하는 것은 아닙니다. 그러나 이 응용 프로그램을 통해 다이어그램 작성 프레임워크의 기초가 되는 상속, 컴퍼지션 및 다양한 C# 구문을 사용하는 방법에 대한 기본 개념을 파악할 수 있습니다.

클래스 디자인
DiagramLib 클래스 라이브러리에는 8개의 클래스가 포함됩니다. 표 1에서는 이러한 클래스 및 해당 용도를 나열합니다.

표 1. DiagramLib 라이브러리의 8개 클래스

클래스 목적
Draggable 이 프로젝트에서 발생하는 대부분의 문제는 개체 이동 및 크기 조정과 관련된 것입니다. 이 일반 Draggable UserControl은 마우스 끌기 동작과 위치 변경을 캡처하기 위한 것입니다.
LabelBox 마우스를 두 번 클릭하면 편집 모드로 전환되는 Label 형식 컨트롤입니다. BlockControl 및 Connector 개체가 사용합니다.
ResizeHandle 크기 조정 작업을 처리하는 BlockControl 주위의 작은 사각형입니다.
ConnectorHandle BlockControl 개체 끌기 및 이 개체에 부착하는 작업을 처리하는 Connector 개체 끝점의 작은 사각형입니다.
DiagramControl BlockControl 및 Connector가 상속을 받는 간단한 클래스입니다. "ID" 등의 일반적인 특성을 제공합니다.
BlockControl 텍스트 입력, 이동 및 크기 조정을 위한 주 다이어그램 작성 컨트롤로, Connector 개체와 연결됩니다.
Connector BlockControl 개체를 선 및 화살표와 연결하는 컨트롤입니다.
DrawingBoard BlockControl 및 Connector 개체를 배치하기 위한 화이트보드입니다.

그림 2그림 3에서는 DiagramLib의 클래스 계층 구조 및 이러한 클래스의 구성/연결을 확인할 수 있습니다. 또한 그림 4에서는 보다 뚜렷하게 다양한 클래스 간의 관계를 이해할 수 있습니다.

그림 2

그림 3

그림 4

Connector를 처리하는 방식에는 두 가지가 있습니다. 첫 번째는 다른 다이어그램 작성 컨트롤과 동일하게 취급하는 것입니다. 즉, Connector를 끌거나 크기를 조정할 수 있습니다. 그러나 보다 중요한 것은 Connector를 다른 화면 개체에 연결하지 않아도 된다는 것입니다. Visio에서는 이 방식을 사용합니다. 두 번째 방식을 사용하는 경우 Connector의 양 끝을 항상 무엇인가에 부착해야 합니다. 그러므로 Connector의 끝점이 아무 것에도 부착되지 않은 상태로 둘 수는 없습니다. Netron에서는 이 방식을 사용합니다. 개인적으로는 첫 번째 방식이 두 번째보다 직관적이라고 생각합니다. 그러므로 이 기사의 디자인은 Visio의 방식을 따릅니다.

다음 섹션에서는 클래스 및 여러 클래스를 함께 사용하는 방법에 대해 자세히 설명합니다.

끌기
Draggable 클래스는 UserControl에서 상속되지만 이 클래스에는 시각적인 구성 요소가 없습니다. 이 클래스는 MouseDown 이벤트 다음에 MouseMove 이벤트와 LocationChanged 이벤트가 뒤따르도록 정의되어 있는 마우스 끌기 동작을 처리합니다. 즉, 화면에서 클래스가 실제로 "끌기"되는 것이 아니라 사용자 정의 이벤트인 DraggableMouseMove, DraggableMouseStop 및 DraggableLocationChanged가 발생하는 것입니다. 이 Draggable 개체의 컨테이너가 실제 이동 또는 크기 조정을 수행합니다. 목록 1에는 Draggable 클래스의 세 가지 마우스 이벤트 처리기인 OnMouseDown, OnMouseUp 및 OnMouseMove가 있습니다.

목록 1. Draggable 클래스의 마우스 처리 루틴
 public event MouseEventHandler DraggableMouseMove; public event MouseEventHandler DraggableMouseStop; protected virtual void OnDraggableMouseStop( MouseEventArgs e) { if (DraggableMouseStop != null) { // 대리자를 호출합니다. DraggableMouseStop(this, e); } } protected virtual void OnDraggableMouseMove( MouseEventArgs e) { if (DraggableMouseMove != null) { // 대리자를 호출합니다. DraggableMouseMove(this, e); } } protected virtual void OnMouseDown(Object o, MouseEventArgs e) { IsMouseDown = true; initX = e.X; initY = e.Y; } protected virtual void OnMouseUp(Object o, MouseEventArgs e) { if (IsMouseDown) { MouseEventArgs evt = new MouseEventArgs( e.Button, e.Clicks, e.X - initX, e.Y - initY, e.Delta); OnDraggableMouseStop(evt); } IsMouseDown = false; } protected virtual void OnMouseMove(object o, MouseEventArgs e) { if (IsMouseDown) { // Delta 값(이동한 거리)만 필요합니다. // e.X는 커서의 상대 위치입니다. MouseEventArgs evt = new MouseEventArgs( e.Button, e.Clicks, e.X - initX, e.Y - initY, e.Delta); OnDraggableMouseMove(evt); } }(참고: 프로그래머 코멘트는 샘플 프로그램 파일에는 영문으로 제공되며 기사에는 설명을 위해 번역문으로 제공됩니다.) 

Draggable 클래스에서는 이벤트 처리기를 제공하는 반면 LabelBox 및 ResizeHandle 클래스에서는 시각적 요소 및 이벤트 처리기 간의 링크를 제공합니다. 예를 들어 ResizeHandle에는 마우스 이벤트를 캡처하고 Draggable 마우스 이벤트 처리기에 작업을 위임하는 Label 컨트롤(lblHandle)이 있습니다.

public ResizeHandle() { ... lblHandle.MouseDown += new MouseEventHandler( base.OnMouseDown); lblHandle.MouseUp += new MouseEventHandler( base.OnMouseUp); lblHandle.MouseMove += new MouseEventHandler( base.OnMouseMove); this.LocationChanged += new EventHandler( base.OnLocationChanged); ... } 

앞서 Draggable 클래스에서 컨트롤의 실제 이동을 처리하지 않음을 언급했습니다. 이는 ResizeHandle 또는 LabelBox도 마찬가지입니다. 이러한 클래스는 DraggableMouseMove 이벤트를 상향 전파하여 부모 BlockControl 개체 또는 Connector 개체가 해당 작업을 처리하도록 합니다.

그림 5는 사용자가 ConnectorHandle을 끌면 클래스가 상호 작용하는 방법을 보여 주는 실제 시나리오 다이어그램입니다.

그림 5

부착 및 부착 해제 프로세스(1부): 부착
Connector의 ConnectorHandle을 BlockControl의 ResizeHandle과 아주 가까운 위치로 끌면 부착이 수행됩니다. 반대로 ConnectorHandle을 연결된 BlockControl에서 비교적 먼 위치로 끌면 연결 부착이 해제됩니다. 이 메커니즘을 설명하려면 BlockControl, Connector 및 ConnectorHandle의 구조를 자세히 살펴봐야 합니다.

BlockControl의 중앙에는 LabelBox가 있고 그 주위에는 8개의 ResizeHandle 개체가 있습니다. ResizeHandle 개체에는 그림 6과 같이 0에서 7까지의 인덱스가 지정되어 있습니다.

그림 6

나중에 살펴보겠지만 ConnectorHandle은 BlockControl에 부착되면 이 번호를 기록하기 때문에, ResizeHandle의 인덱스에는 중요한 의미가 있습니다.

Connector에는 각각 반대쪽 끝에 ConnectorHandle 개체가 두 개 있습니다(그림 7 참조).

그림 7

화면에서 ConnectorHandle을 끌면 모든 기존 BlockControl이 호출되어 해당 ResizeHandle 개체 중 ConnectorHandle에 부착될 수 있을 만큼 가까운 위치에 있는 개체가 있는지 확인합니다. BlockControl의 FindHandle 메서드(목록 2 참조)가 특정 지점으로부터 거리를 계산하여 해당 지점이 충분히 가까운 경우에는 ResizeHandle 인덱스를 반환합니다.

목록 2. BlockControl의 FindHandle 메서드
public int FindHandle(Point p) { const int GLUE_DISTANCE = 20; // 길이 20px int x = this.handles[HD_NW].Left; int y = this.handles[HD_NW].Top; int index = 0; double minDist = double.MaxValue; double dist = 0; for (int i = 0; i < NUM_HANDLE; i++) { ResizeHandle hd = this.handles[i]; dist = Math.Sqrt(Math.Pow(hd.Left - p.X, 2) + Math.Pow(hd.Top - p.Y, 2)); if (dist < minDist) { index = i; minDist = dist; } } if (minDist < GLUE_DISTANCE) { return index; } else { return -1; } } 

그림 8에는 BlockControl이 하나만 있지만 실제로 프로그램에서는 화면의 모든 BlockControl 개체를 호출합니다.

그림 8

BlockControl 개체 중 하나에서 유효한 ResizeHandle 인덱스를 반환하는 경우, 이는 Connector가 해당 BlockControl에 즉시 연결되어야 함을 의미합니다. 그러면 ConnectorHandle 위치가 갑자기 변경되어 맞추기 및 붙이기 형식으로 이동합니다.

ConnectorHandle은 ResizeHandle에서 상속되며 BlockControl에 부착되거나 BlockControl에서 부착이 해제되는 기능이 추가됩니다. ConnectorHandle은 BlockControl에 부착되면 BlockControl 이동을 따르며, 그로 인해 부모 Connector 개체의 크기와 모양을 변경합니다. ConnectorHandle은 부착된 BlockControl 및 ResizeHandle을 기억함으로써 이 작업을 수행합니다.

public class ConnectorHandle: ResizeHandle { private BlockControl connectedBlock; private int blockHandleIndex; ... 

부착 및 부착 해제 프로세스(2부): 부착 후 이동
Connector 및 BlockControl이 서로 부착된 후에 BlockControl의 해당 부분을 끌거나 크기를 조정하면 Connector의 크기도 자동으로 조정됩니다. 이는 ResizeHandle에서 LocationChanged 이벤트를 부모 BlockControl로 전송하면 부모 BlockControl은 연결된 모든 Connector가 해당 ConnectorHandle의 위치를 변경하도록 지시하기 때문입니다(그림 9 참조).

그림 9

부착 및 부착 해제 프로세스(3부): 부착 해제
연결된 BlockControl에서 ConnectorHandle을 끌거나 LabelBox 개체를 끌어 중앙에서 다른 위치로 이동하면 부착 해제가 수행됩니다. 이 작업은 끈 위치가 임계값에 도달할 때까지 마우스 이동을 무시함으로써 수행됩니다.

// ConnectorHandle 클래스 protected override void OnMouseMove(Object o, MouseEventArgs e) { if (this.connectedBlock == null) { base.OnMouseMove(o, e); } else { if (ShouldBreakBinding(e)) { connectedBlock.RemoveConnectorHandle( this, blockHandleIndex); connectedBlock = null; base.OnMouseMove(o, e); } } } private Boolean ShouldBreakBinding(MouseEventArgs e) { return (Math.Sqrt(Math.Pow(e.X,2) + Math.Pow(e.Y, 2)) > 20); } 

Connector의 LabelBox 개체를 끌어서 이동해도 역시 양 끝의 연결이 끊어집니다.

// Connector 클래스 private void Label_DraggableMouseMove(Object o, MouseEventArgs e) { // 핸들 중 하나가 Block 컨트롤에 연결되어 있는 경우 // 저항이 필요합니다. if (handles[0].ConnectedBlockControl != null || handles[1].ConnectedBlockControl != null) { double dist = Math.Sqrt(Math.Pow(e.X, 2) + Math.Pow(e.Y, 2)); if (dist <= 20) return; } ... } 

그림
이 섹션에서는 화면에서 컨트롤을 그리는 방법에 대해 자세히 다룹니다. 일부 컨트롤은 Windows Label로 구성되는 ResizeHandle 같은 Windows 기본 요소만으로 이루어져 있습니다. 그리고 GDI+ 라이브러리를 사용하여 화면 업데이트를 수행하는 컨트롤도 있습니다. 여기서는 GDI+ 관련 컨트롤에 대해 주로 설명합니다.

LabelBox 클래스 LabelBox는 개체의 텍스트 설명을 보여 주는 직사각형 상자입니다(그림 4 참조). BlockControl 및 Connector 클래스는 모두 이 클래스를 사용합니다. 이 클래스를 두 번 클릭하면 텍스트 상자가 표시되어 사용자가 내용을 편집할 수 있습니다. 이름에서 짐작되듯이 이 클래스에는 Label 컨트롤이 포함되어 있다고 생각될 수 있습니다. 그리고 이전 버전까지는 실제로 그랬습니다. 그러나 Label 컨트롤은 새로 고침 속도가 매우 느립니다. 화면에서 함께 움직이는 Label 컨트롤이 5개 이상인 경우에는 속도가 너무 느려서 이상하게 보이기도 합니다. 그러므로 이 LabelBox 버전의 경우에는 GDI+ 호출을 통해 직사각형과 텍스트를 다시 그리도록 했습니다.

// LabelBox 클래스 private void LabelBox_Paint(Object o, PaintEventArgs e) { €| e.Graphics.FillRectangle(backgroundBrush, 0, 0, this.Width, this.Height); e.Graphics.DrawRectangle(textPen, 0, 0, this.Width - 1, this.Height - 1); e.Graphics.DrawString(text, txtEdit.Font, textBrush, 2, 2); } 
Connector DrawingBoard 개체는 화면을 새로 고쳐야 할 때 Connector 개체의 Paint 메서드를 호출합니다. ConnectionStyleEnum 속성이 이 클래스에서 설정할 수 있는 스타일을 지정합니다. 이 값과 각 값을 설정했을 때의 효과가 그림 10에 나와 있습니다.

그림 10

LeftRight 및 UpDown 스타일의 경우 정적 다차원 배열을 사용하여 화살표 회전 각도를 결정합니다.

// Connector 클래스 private static int[,] degrees = new int[4,2]; static Connector() { // 화살촉을 그리기 위한 각도 매트릭스를 초기화합니다. // updown, 핸들 1 위에 핸들 0 degrees[Convert.ToInt16(ConnectorStyleEnum.UpDown), Convert.ToInt16(true)] = 0; // updown, 핸들 1 아래 핸들 0 degrees[Convert.ToInt16(ConnectorStyleEnum.UpDown), Convert.ToInt16(false)] = 180; // leftright, 핸들 1 왼쪽에 핸들 0 degrees[Convert.ToInt16(ConnectorStyleEnum.LeftRight), Convert.ToInt16(true)] = -90; // leftright, 핸들 1 오른쪽에 핸들 0 degrees[Convert.ToInt16(ConnectorStyleEnum.LeftRight), Convert.ToInt16(false)] = 90; } 

정적 생성자가 배열 각도를 초기화합니다. 클래스의 정적 생성자는 응용 프로그램 수명 동안 단 한 번만 호출됩니다. 생성자가 트리거되는 때는 클래스의 첫 번째 인스턴스를 만든 때나 정적 멤버가 처음으로 참조되는 때입니다. 화살표의 회전 각도를 확인하려면 치수를 채우면 됩니다.

// Connector 클래스 private void DrawHandlesArrows(Graphics g) { double h0Deg = 0; double h1Deg = 0; switch (connStyle) { case ConnectorStyleEnum.LeftRight: h0Deg = degrees[(int) connStyle, Convert.ToInt16(handles[0].Left < handles[1].Left)]; break; €| } 

화살촉 좌표가 일련의 점으로 기록됩니다. 그림 11그림 12에는 이러한 점이 각각 좌표축 및 화면 좌표로 표시되어 있습니다.

그림 11

그림 12

선 끝에 올바른 각도로 화살촉을 그리려면 세 가지 변환 작업을 수행해야 합니다.

  • 변환 - 화살촉이 중앙(0, 0)에서 약간 벗어나도록 이동합니다. 이 작업은 화살촉이 ConnectorHandle과 같은 영역에 있지 않도록 하기 위해 수행합니다.

  • 회전 - 선 경사도를 기준으로 정확한 각도를 계산합니다.

  • 변환 - 화살촉을 선 끝으로 이동합니다.

다음 코드 세그먼트에서는 화살촉 생성 및 그림 13에 나와 있는 3단계 변환 과정을 설명합니다.

double grad = (float) (handles[1].Top - handles[0].Top) / (float) (handles[1].Left - handles[0].Left); double deg = Math.Atan(grad) * (180 / Math.PI); €| Point[] p = new Point[] { new Point(0, 0), new Point(5, 7), new Point(0, 5), new Point(-5, 7), new Point(0, 0)}; path.AddLines(p); Matrix m = new Matrix(); m.Translate(x, y); // 직선 끝 m.Rotate((float) deg); m.Translate(0, 5); path.Transform(m); 

그림 13

결론
이 기사에서 소개한 8가지 클래스에는 기본적인 기능만이 포함되지만, 이를 기반으로 하여 보다 수준 높은 프레임워크를 만들 수 있습니다. 즉시 사용할 수 있는 라이브러리가 필요한 경우에는 http://netron.sourceforge.net/ (영문)의 공개 소스 Netron 그래프 라이브러리를 확인해 보십시오.

다운로드 단추를 클릭하면 코드(506LEW.ZIP)를 다운로드할 수 있습니다.

Visual Studio .NET Developer 및 Pinnacle Publishing에 대한 자세한 내용을 보려면 해당 웹 사이트인 http://www.pinpub.com/(영문 사이트)을 방문하십시오.

참고: 이 사이트는 Microsoft Corporation 웹 사이트가 아니므로 Microsoft는 그 내용에 책임을 지지 않습니다.

이 기사는 Visual Studio .NET Developer 2005년 6월호를 바탕으로 다시 쓰여진 것입니다. Copyright 2005, by Pinnacle Publishing, Inc., unless otherwise noted. All rights are reserved. Visual Studio .NET Developer는 Pinnacle Publishing, Inc에서 독립적으로 제작한 발행물입니다. 이 기사의 어떤 부분도 Pinnacle Publishing, Inc.의 사전 동의 없이는 어떤 형식으로도(중요한 기사나 논평에서 간략하게 인용하는 경우는 제외함) 사용하거나 복제할 수 없습니다. Pinnacle Publishing, Inc.에 연락하려면 1-800-788-1900으로 전화 주십시오.


 
출처 : http://www.xdotnet.com/xdotnet/board/BoardRead.aspx?F_Code=11&B_Code=1010&B_Index=1280&B_Page=0
반응형
Posted by blueasa
, |

KeyDown이벤트시에 한글 입력은 무조건 229(?)만 나오기 때문에 어떤 글자를 쳤는지는 알 수가 없지요.

 

그래서 한글 입력은 윈도우 메시지를 가로채서 알아냅니다.

 

먼저 윈도우 메시지를 가로채는 방법은 크게 두가지정도를 생각해 볼 수 있겠는데요,

WndProc 메서드를 오버라이드 하는 방법과 IMessageFilter를 구현해서 가로채는 방법이 있겠습니다.

 

인터넷에 찾아보니 WndProc메서드 오버라이드 하는 방법이 나와있는데 전 이 방법으로는 메시지를 가로챌 수 없더군요..

(왜 안되는지 아시는 분은 답글 남겨 주시기 바랍니다..)

음.. 코딩 환경따라 다른지 모르겠습니다.

참고로 제 환경은 Windows XP Pro 이고 .NET FramWork 1.1 Ver 1.1.4322 환경입니다..

 

 

아무튼.. 메시지 필터를 이용해서 메시지를 가로채기 위해서는

윈폼에서 Application.AddMessageFilter(구현한 필터 클래스) 호출하여 가로채는데

다음과 같은 순서로 하면 되겠습니다.

 

1. 메시지를 가로채서 어떻게 처리할 것인지를 구현한다.

즉 IMessageFilter 클래스를 구현하는것을 의미합니다.

 

구체적으로 이런식으로 구현하면 되겠습니다.

 

    public class MyMessageFilter: IMessageFilter

        {

            #region IMessageFilter 멤버

     

            public const int WM_KEYFIRST = 0x100;

            public const int WM_KEYDOWN = 0x100;

            public const int WM_KEYUP = 0x101;

            public const int WM_CHAR = 0x102;

            public const int WM_IME_STARTCOMPOSITION = 0x10D;

            public const int WM_IME_COMPOSITION = 0x10F;

            public const int WM_IME_ENDCOMPOSITION = 0x10E;

            public const int WM_IME_SETCONTEXT = 0x281;

            public const int WM_IME_NOTIFY = 0x282;

            public const int WM_IME_CONTROL = 0x283;

            public const int WM_IME_COMPOSITIONFULL = 0x284;

            public const int WM_IME_SELECT = 0x285;

            public const int WM_IME_CHAR = 0x286;

            public const int WM_IME_KEYDOWN = 0x290;

            public const int WM_IME_KEYUP = 0x291;

            public const int WM_IME_REPORT = 0x0280;

            public const int WM_IME_REQUEST = 0x0288;

            

            public bool PreFilterMessage(ref Message m)

            {

                // TODO:  MyMessageFilter.PreFilterMessage 구현을 추가합니다.

                Form1 fm = (Form1)Form.ActiveForm;

                

                switch(m.Msg)

                {

                    case WM_IME_STARTCOMPOSITION:

                        fm.WriteLine("한글 조합 시작.." + "\t" + m.WParam.ToString() + "\t" + m.LParam.ToString());

                        break;

     

                    case WM_IME_COMPOSITION:

                        fm.WriteLine("한글 입력 중.." + "\t"+ m.WParam.ToString() + "\t" + m.LParam.ToString());

                        break;

     

                    case WM_IME_ENDCOMPOSITION:

                        fm.WriteLine("한글 조합 완료.." + "\t"+ m.WParam.ToString() + "\t" + m.LParam.ToString());

                        break;

     

                    case WM_IME_SETCONTEXT:

                        fm.WriteLine("WM_IME_SETCONTEXT" + "\t"+ m.WParam.ToString() + "\t" + m.LParam.ToString());

                        break;

                    case WM_IME_NOTIFY:

                        fm.WriteLine("WM_IME_NOTIFY" + "\t"+ m.WParam.ToString() + "\t" + m.LParam.ToString());

                        break;

                    case WM_IME_CONTROL:

                        fm.WriteLine("WM_IME_CONTROL" + "\t"+ m.WParam.ToString() + "\t" + m.LParam.ToString());

                        break;

                    case WM_IME_COMPOSITIONFULL:

                        fm.WriteLine("WM_IME_COMPOSITIONFULL" + "\t"+ m.WParam.ToString() + "\t" + m.LParam.ToString());

                        break;

                    case WM_IME_SELECT:

                        fm.WriteLine("WM_IME_SELECT" + "\t"+ m.WParam.ToString() + "\t" + m.LParam.ToString());

                        break;

                    case WM_IME_CHAR:

                        fm.WriteLine("WM_IME_CHAR" + "\t"+ m.WParam.ToString() + "\t" + m.LParam.ToString());

                        break;

                    case WM_IME_KEYDOWN:

                        fm.WriteLine("WM_IME_KEYDOWN" + "\t"+ m.WParam.ToString() + "\t" + m.LParam.ToString());

                        break;

                    case WM_IME_KEYUP:

                        fm.WriteLine("WM_IME_KEYUP" + "\t"+ m.WParam.ToString() + "\t" + m.LParam.ToString());

                        break;

                    case WM_IME_REPORT:

                        fm.WriteLine("WM_IME_REPORT" + "\t"+ m.WParam.ToString() + "\t" + m.LParam.ToString());

                        break;

                    case WM_IME_REQUEST:

                        fm.WriteLine("WM_IME_REQUEST" + "\t"+ m.WParam.ToString() + "\t" + m.LParam.ToString());

                        break;

     

                    case WM_KEYDOWN:

                        fm.WriteLine("WM_KEYDOWN" + "\t"+ m.WParam.ToString() + "\t" + m.LParam.ToString());

                        break;

                    /*

                    case WM_KEYUP:

                        fm.WriteLine("WM_KEYUP" + "\t"+ m.WParam.ToString() + "\t" + m.LParam.ToString());

                        break;

                    */

                    case WM_CHAR:

                        fm.WriteLine("WM_CHAR" + "\t"+ m.WParam.ToString() + "\t" + m.LParam.ToString());

                        break;

                }

                

                return false;

            }

     

            #endregion

        }//end of class

 

 

2. 윈폼 클래스에서 구현한 필터 클래스를 선언합니다.

 

private MyMessageFilter mmf = new MyMessageFilter();

 

 

 

3. AddMessageFilter()로 메시지 필터를 윈폼클래스에 등록합니다.

 

Application.AddMessageFilter(mmf);

 

폼 생성자 메서드에서 등록하면 되겠네요..

 

 

참.. 제 소스에서는

윈폼 클래스에 다음과 같은 메서드를 추가했었죠..

 

        public void WriteLine(string str)

        {

            this.textBox1.Text += str + "\r\n";

        }

 

이로서 한글을 입력할때 어떤 메시지가 어떻게 발생하는 지 대충 알 수 있으리라고 생각됩니다.

출처 : Devpia


출처 : http://www.xdotnet.com/xdotnet/board/BoardRead.aspx?F_Code=14&B_Code=1052&B_Index=1294&B_Page=0

반응형
Posted by blueasa
, |

using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace QEControls
{
/// <summary>
/// Summary description for FlickerFreeRichEditTextBox.
/// </summary>
public class FlickerFreeRichEditTextBox : RichTextBox
{

// #define WM_PAINT 0x000F

const short WM_PAINT = 0x00f;
const short WM_IME_NOTIFY = 0x0282;
const int IME_CMODE_NATIVE = 0x1;
//const short IMN_SETCONVERSIONMODE = 0x06;
private IntPtr IMN_SETCONVERSIONMODE = new IntPtr(0x06);

public FlickerFreeRichEditTextBox()
{
//
// TODO: Add constructor logic here
//
//SetStyle(ControlStyles.AllPaintingInWmPaint, true);
//SetStyle(ControlStyles.DoubleBuffer , true);
//SetStyle(ControlStyles.UserPaint , true);
_Paint = true;
this.ScrollBars = RichTextBoxScrollBars.Both;
}

[DllImport ("imm32.dll", CharSet=CharSet.Auto)]
public static extern int ImmGetContext (int hWnd);

[DllImport ("imm32.dll", CharSet=CharSet.Auto)]
public static extern int ImmReleaseContext (int hWnd, int hImc);

[DllImport ("imm32.dll", CharSet=CharSet.Auto)]
public static extern int ImmGetConversionStatus (int hImc, out int
fdwConversion, out int fdwSentence);

private bool _isHangulMode = false;
public bool IsHangulMode
{
get { return _isHangulMode; }
}

public bool _Paint = true;
public bool IsPainting
{
get
{
return _Paint;
}
}
protected override void WndProc(ref System.Windows.Forms.Message m)
{
if (m.Msg == WM_PAINT)
{
if (_Paint)
base.WndProc(ref m);
else
m.Result = IntPtr.Zero;
}
else if ( m.Msg == WM_IME_NOTIFY )
{
if ( m.WParam == IMN_SETCONVERSIONMODE )
{
int hImc, dwConversion = 0, dwSentense = 0;
hImc = ImmGetContext(this.Handle.ToInt32());
ImmGetConversionStatus(hImc, out dwConversion, out dwSentense);
if ( (dwConversion & IME_CMODE_NATIVE) == 1 )
{ // 한글모드
//System.Diagnostics.Trace.WriteLine("한글모드");
_isHangulMode = true;
}
else
{
//System.Diagnostics.Trace.WriteLine("English Mode");
_isHangulMode = false;
}
ImmReleaseContext(this.Handle.ToInt32(), hImc);
}
}
else
{
base.WndProc (ref m);
}
}

public void BeginUpdate()
{
_Paint = false;
}

public void EndUpdate()
{
_Paint = true;
}
}
}

출처 : http://www.ms-news.net/f2235/iso-8859-1-b-cmljahrlehrcb3i-oscw-mfrimh6ua7a1ltptnku-5396626.html
반응형
Posted by blueasa
, |

Hello :)

I'm working on a bit of a 2D engine and want it to work with the IME.  Now, normally with a desktop app you don't need any particularly special IME support for an IME to work with your app, you can just start typing in a text box and voila, asian characters (for the most part).  What's actually happening when you're typing asian characters is the IME is drawing windows above your application's window that contains these characters, as I understand it.  In a fullscreen game without typical input widgets, the IME has no idea where to display these windows, and even if it knew where to display those widgets, they wouldn't show up in your fullscreen app.  This means you need to read and send information to the IME directly and take any information you get from it and duplicate what it would've done by itself had you been making a regular desktop app (meaning, draw your own character candidate display, composition display, etc)

My
 2D engine thus far is in .NET 2.0 C# Managed DX.  In the August 2006 SDK, the VC++ DX utility classes contain an example textbox class that contains IME support.  The Managed DX utility classes do not contain any IME support example.  Most of the information I've found by researching around is only for desktop apps that want to extend their support for IMEs beyond the default, rather than support for fullscreen apps.


First I'll lay out what information I've found to be useful in this endeavor:

MSDN: Using an Input Method Editor in a Game (this helps to explain the VC++ DX textbox IME example)
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/Using_an_Input_Method_Editor_in_a_Game.asp

MSDN: Input Method Editor Function Reference
http://msdn.microsoft.com/library/en-us/intl/ime_038z.asp

Header file containing actual enumeration values I didn't find anywhere else
http://www.rpi.edu/dept/cis/software/yesterday/g77-mingw32/include/imm.h

August 2006 SDK C++ DXUT class containing textbox with IME support
C:\Program Files\Microsoft DirectX SDK (August 2006)\Samples\C++\DXUT\Optional\DXUTgui.cpp

Some IME Reference Stuff
http://www.osronline.com/ddkx/appendix/imeimes2_35ph.htm
http://www.osronline.com/ddkx/appendix/imeimes_0h2s.htm

Misc IME Related C# Code
http://www.koders.com/csharp/fidEB8980C0605213D81D1D8364B00F09538F1DF83D.aspx
http://tsuge.astgate.biz/witchgarden/?C%23+Tips%2FWitchPaper%A4%C7%BC%C2%C1%F5%A4%B7%A4%BFIME%C0%A9%B8%E6
http://www.atmarkit.co.jp/bbs/phpBB/viewtopic.php?topic=7712&forum=7

.NET Win32 API Reference Stuff (since you need to use external functions in imm32.dll and user32.dll)
http://www.dotnetwire.com/frame_redirect.asp?newsid=5368
http://www.pinvoke.net/
http://custom.programming-in.net/


So, that's where I'm coming from.  Here's where I'm at.  If you are familiar with the IME language bar, the floating toolbar allows you to select which input language you'd like to use at the moment, along with the input mode.  This input language and other details that you select are context sensitive and will only be used for the window/thread you set them in.  So if you open up Notepad.exe and switch to Japanese input, you'll have Japanese input available in Notepad, but if you switch to another Notepad.exe that you happened to have open, you'll still be in English language mode (until you set it to Japanese also).

Now, if you click somewhere on an app that isn't a textbox, so you have no text entry area selected while you're in Japanese input mode, you'll notice all of the icons on the IME language bar go disabled, naturally, because you can't input anything, so it won't bother trying to handle any input or send any characters.  The second you select a text entry area, bam, those icons become available again.

When I run my 2D engine in windowed mode and watch the IME language bar, I can use the ALT+SHIFT hotkey to switch language modes and receive that window message via WndProc, allowing me to spew text in my engine that says what the current input language is set to, but all of the language bar icons are disabled.  This is common sense and is expected.

The problem is, so far I have had no luck in getting the IME to recognize the input context and accept my commands to it to switch the ConversionStatus or even to begin it's composition string for me to detect. I'm not sure if I have to tell it to start a composition string and then it notifies the window back that it's starting, or if I just wait, but it won't bother starting any composition string until it's even in the right conversion mode (I imagine).

So now, I will refer to an area of the MSDN: Using an Input Method Editor in a Game (link above) article that has been stuck in my head.

"A full-screen application must properly handle the following IME-related messages:

"
I am handling WM_INPUTLANGCHANGE(via the .NET built in OnInputLanguageChange) and WM_IME_SETCONTEXT.  The other messages I won't receive until the IME is ready to do something, and so far I haven't gotten the IME to be ready to actually do anything :). I am sure there's more I need to do than just get these basic messages and respond to them, because it doesn't seem to be doing much.  If anyone knows anyone who might be able to point me in the right direction, it would be magically delicious.


For now, here is some of the code.  I have created a namespace called External that has a class called IME in it.  So IME.Something is referring to stuff in this class.  I have all of the dll imports and struct values contained in it.

// Incoming Window Message Events
protected override void WndProc(ref Message m) {
   switch ((IME.Message)m.Msg) {
      case IME.Message.WM_IME_SETCONTEXT:
         IME.imcHandle = IME.ImmGetContext(this.Handle);
         USER32.SendMessage(IME.imcHandle, m.Msg, m.WParam, IntPtr.Zero);
         IME.ImmReleaseContext(this.Handle, IME.imcHandle);
         break;
   }

   base.WndProc(ref m);
}

// OnInputLanguageChanged Event
protected override void OnInputLanguageChanged(InputLanguageChangedEventArgs e) {

   // Get IMC Handle
   IME.imcHandle = IME.ImmGetContext(this.Handle);

   // Get language and layout details
  
keys.languageFullName = e.InputLanguage.Culture.EnglishName;
   keys.languageShortName = e.InputLanguage.Culture.TwoLetterISOLanguageName;
   keys.layoutID = e.InputLanguage.Culture.KeyboardLayoutId;

   // Get current Conversion and Sentence Modes into IME.current*
  
IME.ImmGetConversionStatus(IME.imcHandle,ref IME.currentConversionMode,ref IME.currentSentenceMode);

   if (IME.currentConversionMode == 0 && keys.languageShortName == "ja") {
      IME.currentConversionMode = (int) IME.ConversionMode.IME_CMODE_NATIVE;
      IME.currentSentenceMode = (int) IME.SentenceMode.IME_SMODE_AUTOMATIC;

      IME.ImmSetConversionStatus(IME.imcHandle,(int)IME.ConversionMode.IME_CMODE_NATIVE | (int) IME.ConversionMode.IME_CMODE_FULLSHAPE, (int)IME.SentenceMode.IME_SMODE_AUTOMATIC);

   }

   if (IME.currentConversionMode != 0 && keys.languageShortName == "en") {
      IME.currentConversionMode = 0;
      IME.currentSentenceMode = (int) IME.SentenceMode.IME_SMODE_NONE;

      IME.ImmSetConversionStatus(IME.imcHandle, (int) IME.ConversionMode.IME_CMODE_ALPHANUMERIC, (int) IME.SentenceMode.IME_SMODE_NONE);

   }

   // Release IMC Handle
   IME.ImmReleaseContext(this.Handle, IME.imcHandle);

   base.OnInputLanguageChanged(e);

}


Of course that is only a very small portion of code that will be necessary for this whole thing to work when it's complete.  I'll also restate, I do not expect this code to do what I'm after, I'm looking for info on what to do next in order to achieve the desired result.  I've tried a couple things, but if anyone has done this before or has further insight, it would sure speed things up.  I imagine it's something very simple.

-Crache


출처 : http://social.msdn.microsoft.com/forums/en-US/gametechnologiesdirectx101/thread/32e53d65-4f99-4e47-9207-7254a96af33e/

반응형
Posted by blueasa
, |

Custom Control 등을 구현 할 때 많이 사용되는 사용자 정의 이벤트를 만드는 법을 간단하게 정리 해봤습니다.

1. 핸들러 타입 정의

  이벤트 핸들러 타입을 정의 합니다. 필요에 따라 전달 값을 정의하면 됩니다.
  혹은 이미 .NET Framework에 정의된 핸들러를 사용해도 됩니다.

#region [컨트롤 이벤트 정의]
/// Boolean 값을 전달하는 Event Handler 
public delegate void wizEventHandlerBool(bool checkState);
/// 실행 상태가 변경 되었을 때 발생
public event wizEventHandlerBool StateChanged;
#endregion
 

2. 컨트롤에서 사용될 이벤트 전달 함수를 구현

  컨트롤 내부에서 이벤트를 처리 할 함수를 생성합니다.
  해당 델리케이트로 이벤트가 선언되어있는지 체크 후 이벤트를 발생 시킵니다.

#region [컨트롤 이벤트 구현][OnStateChanged]
/// 페이지 변경 이벤트
protected void OnStateChanged()
{ if(StateChanged != null) { StateChanged(this.cIsRun.Checked); } }
#endregion
 

3. 이벤트를 발생시킬 곳에서 이벤트 전달 함수를 호출

  필요한 곳에서 정의한 이벤트 전달 함수를 호출 하면 됩니다.
  예제에서는 체크박스의 상태가 변경된 경우 해당 이벤트를 발생시키도록 구현했습니다.


#region [Event][cIsRun_CheckedChanged]
private void cIsRun_CheckedChanged(object sender, EventArgs e)
{
	OnStateChanged();
}
#endregion
 
나머지는 일반 컨트롤에서 이벤트 처리 함수를 구현하는 방법과 동일 합니다.


출처 : http://wiz.pe.kr/180
반응형
Posted by blueasa
, |

IntPtr target_window = ...

            Point start_point = ...

 

            IntPtr lParamStartPoint = (IntPtr) BND.Windows.Helper.MakeParam(start_point.X, start_point.Y);

 

 

            // 1. 마우스 이동

            System.Windows.Forms.Message mouse_move_to_start = System.Windows.Forms.Message.Create(target_window, BND.Windows.Messages.WM_MOUSEMOVE, (IntPtr) BND.Windows.MouseMasks.MK_NULL, lParamStartPoint);

            BND.Windows.User32.PostMessage(mouse_move_to_start);

 

 

            // 2. 마우스 누름

            System.Windows.Forms.Message mouse_down = System.Windows.Forms.Message.Create(target_window, BND.Windows.Messages.WM_LBUTTONDOWN, (IntPtr) BND.Windows.MouseMasks.MK_NULL, lParamStartPoint);

            BND.Windows.User32.PostMessage(mouse_down);

 

 

-------------------------

 

        //

        // MakeParam

        //

 

        public static int MakeParam(int LoWord, int HiWord)

        {

            return (((HiWord & 0x000000FF) << 16) | (LoWord & 0x000000FF));

        }

 

-------------------------

 

 

        [DllImport("User32")] public extern static bool PostMessage(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam);

 

 

        public static bool PostMessage(System.Windows.Forms.Message m)

        {

            return PostMessage(m.HWnd, m.Msg, m.WParam, m.LParam);

        }

 

--------------------------

 

    public class Messages

    {

        public const int WM_NULL = 0x0000;

        public const int WM_CREATE = 0x0001;

        public const int WM_DESTROY = 0x0002;

        public const int WM_MOVE = 0x0003;

        public const int WM_SIZE = 0x0005;

        public const int WM_ACTIVATE = 0x0006;

        public const int WM_SETFOCUS = 0x0007;

        public const int WM_KILLFOCUS = 0x0008;

        public const int WM_ENABLE = 0x000A;

        public const int WM_SETREDRAW = 0x000B;

        public const int WM_SETTEXT = 0x000C;

        public const int WM_GETTEXT = 0x000D;

        public const int WM_GETTEXTLENGTH = 0x000E;

        public const int WM_PAINT = 0x000F;

        public const int WM_CLOSE = 0x0010;

        public const int WM_QUERYENDSESSION = 0x0011;

        public const int WM_QUERYOPEN = 0x0013;

        public const int WM_ENDSESSION = 0x0016;

        public const int WM_QUIT = 0x0012;

        public const int WM_ERASEBKGND = 0x0014;

        public const int WM_SYSCOLORCHANGE = 0x0015;

        public const int WM_SHOWWINDOW = 0x0018;

        public const int WM_WININICHANGE = 0x001A;

        public const int WM_SETTINGCHANGE = 0x001A;

        public const int WM_DEVMODECHANGE = 0x001B;

        public const int WM_ACTIVATEAPP = 0x001C;

        public const int WM_FONTCHANGE = 0x001D;

        public const int WM_TIMECHANGE = 0x001E;

        public const int WM_CANCELMODE = 0x001F;

        public const int WM_SETCURSOR = 0x0020;

        public const int WM_MOUSEACTIVATE = 0x0021;

        public const int WM_CHILDACTIVATE = 0x0022;

        public const int WM_QUEUESYNC = 0x0023;

        public const int WM_GETMINMAXINFO = 0x0024;

        public const int WM_PAINTICON = 0x0026;

        public const int WM_ICONERASEBKGND = 0x0027;

        public const int WM_NEXTDLGCTL = 0x0028;

        public const int WM_SPOOLERSTATUS = 0x002A;

        public const int WM_DRAWITEM = 0x002B;

        public const int WM_MEASUREITEM = 0x002C;

        public const int WM_DELETEITEM = 0x002D;

        public const int WM_VKEYTOITEM = 0x002E;

        public const int WM_CHARTOITEM = 0x002F;

        public const int WM_SETFONT = 0x0030;

        public const int WM_GETFONT = 0x0031;

        public const int WM_SETHOTKEY = 0x0032;

        public const int WM_GETHOTKEY = 0x0033;

        public const int WM_QUERYDRAGICON = 0x0037;

        public const int WM_COMPAREITEM = 0x0039;

        public const int WM_GETOBJECT = 0x003D;

        public const int WM_COMPACTING = 0x0041;

        public const int WM_COMMNOTIFY = 0x0044;

        public const int WM_WINDOWPOSCHANGING = 0x0046;

        public const int WM_WINDOWPOSCHANGED = 0x0047;

        public const int WM_POWER = 0x0048;

        public const int WM_COPYDATA = 0x004A;

        public const int WM_CANCELJOURNAL = 0x004B;

        public const int WM_NOTIFY = 0x004E;

        public const int WM_INPUTLANGCHANGEREQUEST = 0x0050;

        public const int WM_INPUTLANGCHANGE = 0x0051;

        public const int WM_TCARD = 0x0052;

        public const int WM_HELP = 0x0053;

        public const int WM_USERCHANGED = 0x0054;

        public const int WM_NOTIFYFORMAT = 0x0055;

        public const int WM_CONTEXTMENU = 0x007B;

        public const int WM_STYLECHANGING = 0x007C;

        public const int WM_STYLECHANGED = 0x007D;

        public const int WM_DISPLAYCHANGE = 0x007E;

        public const int WM_GETICON = 0x007F;

        public const int WM_SETICON = 0x0080;

        public const int WM_NCCREATE = 0x0081;

        public const int WM_NCDESTROY = 0x0082;

        public const int WM_NCCALCSIZE = 0x0083;

        public const int WM_NCHITTEST = 0x0084;

        public const int WM_NCPAINT = 0x0085;

        public const int WM_NCACTIVATE = 0x0086;

        public const int WM_GETDLGCODE = 0x0087;

        public const int WM_SYNCPAINT = 0x0088;

        public const int WM_NCMOUSEMOVE = 0x00A0;

        public const int WM_NCLBUTTONDOWN = 0x00A1;

        public const int WM_NCLBUTTONUP = 0x00A2;

        public const int WM_NCLBUTTONDBLCLK = 0x00A3;

        public const int WM_NCRBUTTONDOWN = 0x00A4;

        public const int WM_NCRBUTTONUP = 0x00A5;

        public const int WM_NCRBUTTONDBLCLK = 0x00A6;

        public const int WM_NCMBUTTONDOWN = 0x00A7;

        public const int WM_NCMBUTTONUP = 0x00A8;

        public const int WM_NCMBUTTONDBLCLK = 0x00A9;

        public const int WM_NCXBUTTONDOWN = 0x00AB;

        public const int WM_NCXBUTTONUP = 0x00AC;

        public const int WM_NCXBUTTONDBLCLK = 0x00AD;

        public const int WM_INPUT = 0x00FF;

        public const int WM_KEYFIRST = 0x0100;

        public const int WM_KEYDOWN = 0x0100;

        public const int WM_KEYUP = 0x0101;

        public const int WM_CHAR = 0x0102;

        public const int WM_DEADCHAR = 0x0103;

        public const int WM_SYSKEYDOWN = 0x0104;

        public const int WM_SYSKEYUP = 0x0105;

        public const int WM_SYSCHAR = 0x0106;

        public const int WM_SYSDEADCHAR = 0x0107;

        public const int WM_UNICHAR = 0x0109;

        public const int WM_KEYLAST_NT501 = 0x0109;

        public const int UNICODE_NOCHAR = 0xFFFF;

        public const int WM_KEYLAST_PRE501 = 0x0108;

        public const int WM_IME_STARTCOMPOSITION = 0x010D;

        public const int WM_IME_ENDCOMPOSITION = 0x010E;

        public const int WM_IME_COMPOSITION = 0x010F;

        public const int WM_IME_KEYLAST = 0x010F;

        public const int WM_INITDIALOG = 0x0110;

        public const int WM_COMMAND = 0x0111;

        public const int WM_SYSCOMMAND = 0x0112;

        public const int WM_TIMER = 0x0113;

        public const int WM_HSCROLL = 0x0114;

        public const int WM_VSCROLL = 0x0115;

        public const int WM_INITMENU = 0x0116;

        public const int WM_INITMENUPOPUP = 0x0117;

        public const int WM_MENUSELECT = 0x011F;

        public const int WM_MENUCHAR = 0x0120;

        public const int WM_ENTERIDLE = 0x0121;

        public const int WM_MENURBUTTONUP = 0x0122;

        public const int WM_MENUDRAG = 0x0123;

        public const int WM_MENUGETOBJECT = 0x0124;

        public const int WM_UNINITMENUPOPUP = 0x0125;

        public const int WM_MENUCOMMAND = 0x0126;

        public const int WM_CHANGEUISTATE = 0x0127;

        public const int WM_UPDATEUISTATE = 0x0128;

        public const int WM_QUERYUISTATE = 0x0129;

        public const int WM_CTLCOLORMSGBOX = 0x0132;

        public const int WM_CTLCOLOREDIT = 0x0133;

        public const int WM_CTLCOLORLISTBOX = 0x0134;

        public const int WM_CTLCOLORBTN = 0x0135;

        public const int WM_CTLCOLORDLG = 0x0136;

        public const int WM_CTLCOLORSCROLLBAR = 0x0137;

        public const int WM_CTLCOLORSTATIC = 0x0138;

        public const int WM_MOUSEFIRST = 0x0200;

        public const int WM_MOUSEMOVE = 0x0200;

        public const int WM_LBUTTONDOWN = 0x0201;

        public const int WM_LBUTTONUP = 0x0202;

        public const int WM_LBUTTONDBLCLK = 0x0203;

        public const int WM_RBUTTONDOWN = 0x0204;

        public const int WM_RBUTTONUP = 0x0205;

        public const int WM_RBUTTONDBLCLK = 0x0206;

        public const int WM_MBUTTONDOWN = 0x0207;

        public const int WM_MBUTTONUP = 0x0208;

        public const int WM_MBUTTONDBLCLK = 0x0209;

        public const int WM_MOUSEWHEEL = 0x020A;

        public const int WM_XBUTTONDOWN = 0x020B;

        public const int WM_XBUTTONUP = 0x020C;

        public const int WM_XBUTTONDBLCLK = 0x020D;

        public const int WM_MOUSELAST_5 = 0x020D;

        public const int WM_MOUSELAST_4 = 0x020A;

        public const int WM_MOUSELAST_PRE_4 = 0x0209;

        public const int WM_PARENTNOTIFY = 0x0210;

        public const int WM_ENTERMENULOOP = 0x0211;

        public const int WM_EXITMENULOOP = 0x0212;

        public const int WM_NEXTMENU = 0x0213;

        public const int WM_SIZING = 0x0214;

        public const int WM_CAPTURECHANGED = 0x0215;

        public const int WM_MOVING = 0x0216;

        public const int WM_POWERBROADCAST = 0x0218;

        public const int WM_DEVICECHANGE = 0x0219;

        public const int WM_MDICREATE = 0x0220;

        public const int WM_MDIDESTROY = 0x0221;

        public const int WM_MDIACTIVATE = 0x0222;

        public const int WM_MDIRESTORE = 0x0223;

        public const int WM_MDINEXT = 0x0224;

        public const int WM_MDIMAXIMIZE = 0x0225;

        public const int WM_MDITILE = 0x0226;

        public const int WM_MDICASCADE = 0x0227;

        public const int WM_MDIICONARRANGE = 0x0228;

        public const int WM_MDIGETACTIVE = 0x0229;

        public const int WM_MDISETMENU = 0x0230;

        public const int WM_ENTERSIZEMOVE = 0x0231;

        public const int WM_EXITSIZEMOVE = 0x0232;

        public const int WM_DROPFILES = 0x0233;

        public const int WM_MDIREFRESHMENU = 0x0234;

        public const int WM_IME_SETCONTEXT = 0x0281;

        public const int WM_IME_NOTIFY = 0x0282;

        public const int WM_IME_CONTROL = 0x0283;

        public const int WM_IME_COMPOSITIONFULL = 0x0284;

        public const int WM_IME_SELECT = 0x0285;

        public const int WM_IME_CHAR = 0x0286;

        public const int WM_IME_REQUEST = 0x0288;

        public const int WM_IME_KEYDOWN = 0x0290;

        public const int WM_IME_KEYUP = 0x0291;

        public const int WM_MOUSEHOVER = 0x02A1;

        public const int WM_MOUSELEAVE = 0x02A3;

        public const int WM_NCMOUSEHOVER = 0x02A0;

        public const int WM_NCMOUSELEAVE = 0x02A2;

        public const int WM_WTSSESSION_CHANGE = 0x02B1;

        public const int WM_TABLET_FIRST = 0x02c0;

        public const int WM_TABLET_LAST = 0x02df;

        public const int WM_CUT = 0x0300;

        public const int WM_COPY = 0x0301;

        public const int WM_PASTE = 0x0302;

        public const int WM_CLEAR = 0x0303;

        public const int WM_UNDO = 0x0304;

        public const int WM_RENDERFORMAT = 0x0305;

        public const int WM_RENDERALLFORMATS = 0x0306;

        public const int WM_DESTROYCLIPBOARD = 0x0307;

        public const int WM_DRAWCLIPBOARD = 0x0308;

        public const int WM_PAINTCLIPBOARD = 0x0309;

        public const int WM_VSCROLLCLIPBOARD = 0x030A;

        public const int WM_SIZECLIPBOARD = 0x030B;

        public const int WM_ASKCBFORMATNAME = 0x030C;

        public const int WM_CHANGECBCHAIN = 0x030D;

        public const int WM_HSCROLLCLIPBOARD = 0x030E;

        public const int WM_QUERYNEWPALETTE = 0x030F;

        public const int WM_PALETTEISCHANGING = 0x0310;

        public const int WM_PALETTECHANGED = 0x0311;

        public const int WM_HOTKEY = 0x0312;

        public const int WM_PRINT = 0x0317;

        public const int WM_PRINTCLIENT = 0x0318;

        public const int WM_APPCOMMAND = 0x0319;

        public const int WM_THEMECHANGED = 0x031A;

        public const int WM_HANDHELDFIRST = 0x0358;

        public const int WM_HANDHELDLAST = 0x035F;

        public const int WM_AFXFIRST = 0x0360;

        public const int WM_AFXLAST = 0x037F;

        public const int WM_PENWINFIRST = 0x0380;

        public const int WM_PENWINLAST = 0x038F;

        public const int WM_APP = 0x8000;

        public const int WM_USER = 0x0400;

        public const int EM_GETSEL = 0x00B0;

        public const int EM_SETSEL = 0x00B1;

        public const int EM_GETRECT = 0x00B2;

        public const int EM_SETRECT = 0x00B3;

        public const int EM_SETRECTNP = 0x00B4;

        public const int EM_SCROLL = 0x00B5;

        public const int EM_LINESCROLL = 0x00B6;

        public const int EM_SCROLLCARET = 0x00B7;

        public const int EM_GETMODIFY = 0x00B8;

        public const int EM_SETMODIFY = 0x00B9;

        public const int EM_GETLINECOUNT = 0x00BA;

        public const int EM_LINEINDEX = 0x00BB;

        public const int EM_SETHANDLE = 0x00BC;

        public const int EM_GETHANDLE = 0x00BD;

        public const int EM_GETTHUMB = 0x00BE;

        public const int EM_LINELENGTH = 0x00C1;

        public const int EM_REPLACESEL = 0x00C2;

        public const int EM_GETLINE = 0x00C4;

        public const int EM_LIMITTEXT = 0x00C5;

        public const int EM_CANUNDO = 0x00C6;

        public const int EM_UNDO = 0x00C7;

        public const int EM_FMTLINES = 0x00C8;

        public const int EM_LINEFROMCHAR = 0x00C9;

        public const int EM_SETTABSTOPS = 0x00CB;

        public const int EM_SETPASSWORDCHAR = 0x00CC;

        public const int EM_EMPTYUNDOBUFFER = 0x00CD;

        public const int EM_GETFIRSTVISIBLELINE = 0x00CE;

        public const int EM_SETREADONLY = 0x00CF;

        public const int EM_SETWORDBREAKPROC = 0x00D0;

        public const int EM_GETWORDBREAKPROC = 0x00D1;

        public const int EM_GETPASSWORDCHAR = 0x00D2;

        public const int EM_SETMARGINS = 0x00D3;

        public const int EM_GETMARGINS = 0x00D4;

        public const int EM_SETLIMITTEXT = EM_LIMITTEXT;

        public const int EM_GETLIMITTEXT = 0x00D5;

        public const int EM_POSFROMCHAR = 0x00D6;

        public const int EM_CHARFROMPOS = 0x00D7;

        public const int EM_SETIMESTATUS = 0x00D8;

        public const int EM_GETIMESTATUS = 0x00D9;

        public const int BM_GETCHECK= 0x00F0;

        public const int BM_SETCHECK= 0x00F1;

        public const int BM_GETSTATE= 0x00F2;

        public const int BM_SETSTATE= 0x00F3;

        public const int BM_SETSTYLE= 0x00F4;

        public const int BM_CLICK = 0x00F5;

        public const int BM_GETIMAGE= 0x00F6;

        public const int BM_SETIMAGE= 0x00F7;

        public const int STM_SETICON = 0x0170;

        public const int STM_GETICON = 0x0171;

        public const int STM_SETIMAGE = 0x0172;

        public const int STM_GETIMAGE = 0x0173;

        public const int STM_MSGMAX = 0x0174;

        public const int DM_GETDEFID = (WM_USER+0);

        public const int DM_SETDEFID = (WM_USER+1);

        public const int DM_REPOSITION = (WM_USER+2);

        public const int LB_ADDSTRING = 0x0180;

        public const int LB_INSERTSTRING = 0x0181;

        public const int LB_DELETESTRING = 0x0182;

        public const int LB_SELITEMRANGEEX= 0x0183;

        public const int LB_RESETCONTENT = 0x0184;

        public const int LB_SETSEL = 0x0185;

        public const int LB_SETCURSEL = 0x0186;

        public const int LB_GETSEL = 0x0187;

        public const int LB_GETCURSEL = 0x0188;

        public const int LB_GETTEXT = 0x0189;

        public const int LB_GETTEXTLEN = 0x018A;

        public const int LB_GETCOUNT = 0x018B;

        public const int LB_SELECTSTRING = 0x018C;

        public const int LB_DIR = 0x018D;

        public const int LB_GETTOPINDEX = 0x018E;

        public const int LB_FINDSTRING = 0x018F;

        public const int LB_GETSELCOUNT = 0x0190;

        public const int LB_GETSELITEMS = 0x0191;

        public const int LB_SETTABSTOPS = 0x0192;

        public const int LB_GETHORIZONTALEXTENT = 0x0193;

        public const int LB_SETHORIZONTALEXTENT = 0x0194;

        public const int LB_SETCOLUMNWIDTH = 0x0195;

        public const int LB_ADDFILE = 0x0196;

        public const int LB_SETTOPINDEX = 0x0197;

        public const int LB_GETITEMRECT = 0x0198;

        public const int LB_GETITEMDATA = 0x0199;

        public const int LB_SETITEMDATA = 0x019A;

        public const int LB_SELITEMRANGE = 0x019B;

        public const int LB_SETANCHORINDEX = 0x019C;

        public const int LB_GETANCHORINDEX = 0x019D;

        public const int LB_SETCARETINDEX = 0x019E;

        public const int LB_GETCARETINDEX = 0x019F;

        public const int LB_SETITEMHEIGHT = 0x01A0;

        public const int LB_GETITEMHEIGHT = 0x01A1;

        public const int LB_FINDSTRINGEXACT = 0x01A2;

        public const int LB_SETLOCALE = 0x01A5;

        public const int LB_GETLOCALE = 0x01A6;

        public const int LB_SETCOUNT = 0x01A7;

        public const int LB_INITSTORAGE = 0x01A8;

        public const int LB_ITEMFROMPOINT = 0x01A9;

        public const int LB_MULTIPLEADDSTRING = 0x01B1;

        public const int LB_GETLISTBOXINFO= 0x01B2;

        public const int LB_MSGMAX_501 = 0x01B3;

        public const int LB_MSGMAX_WCE4 = 0x01B1;

        public const int LB_MSGMAX_4 = 0x01B0;

        public const int LB_MSGMAX_PRE4 = 0x01A8;

        public const int CB_GETEDITSEL = 0x0140;

        public const int CB_LIMITTEXT = 0x0141;

        public const int CB_SETEDITSEL = 0x0142;

        public const int CB_ADDSTRING = 0x0143;

        public const int CB_DELETESTRING = 0x0144;

        public const int CB_DIR = 0x0145;

        public const int CB_GETCOUNT = 0x0146;

        public const int CB_GETCURSEL = 0x0147;

        public const int CB_GETLBTEXT = 0x0148;

        public const int CB_GETLBTEXTLEN = 0x0149;

        public const int CB_INSERTSTRING = 0x014A;

        public const int CB_RESETCONTENT = 0x014B;

        public const int CB_FINDSTRING = 0x014C;

        public const int CB_SELECTSTRING = 0x014D;

        public const int CB_SETCURSEL = 0x014E;

        public const int CB_SHOWDROPDOWN = 0x014F;

        public const int CB_GETITEMDATA = 0x0150;

        public const int CB_SETITEMDATA = 0x0151;

        public const int CB_GETDROPPEDCONTROLRECT = 0x0152;

        public const int CB_SETITEMHEIGHT = 0x0153;

        public const int CB_GETITEMHEIGHT = 0x0154;

        public const int CB_SETEXTENDEDUI = 0x0155;

        public const int CB_GETEXTENDEDUI = 0x0156;

        public const int CB_GETDROPPEDSTATE = 0x0157;

        public const int CB_FINDSTRINGEXACT = 0x0158;

        public const int CB_SETLOCALE = 0x0159;

        public const int CB_GETLOCALE = 0x015A;

        public const int CB_GETTOPINDEX = 0x015B;

        public const int CB_SETTOPINDEX = 0x015C;

        public const int CB_GETHORIZONTALEXTENT = 0x015d;

        public const int CB_SETHORIZONTALEXTENT = 0x015e;

        public const int CB_GETDROPPEDWIDTH = 0x015f;

        public const int CB_SETDROPPEDWIDTH = 0x0160;

        public const int CB_INITSTORAGE = 0x0161;

        public const int CB_MULTIPLEADDSTRING = 0x0163;

        public const int CB_GETCOMBOBOXINFO = 0x0164;

        public const int CB_MSGMAX_501 = 0x0165;

        public const int CB_MSGMAX_WCE400 = 0x0163;

        public const int CB_MSGMAX_400 = 0x0162;

        public const int CB_MSGMAX_PRE400 = 0x015B;

        public const int SBM_SETPOS = 0x00E0;

        public const int SBM_GETPOS = 0x00E1;

        public const int SBM_SETRANGE = 0x00E2;

        public const int SBM_SETRANGEREDRAW = 0x00E6;

        public const int SBM_GETRANGE = 0x00E3;

        public const int SBM_ENABLE_ARROWS = 0x00E4;

        public const int SBM_SETSCROLLINFO = 0x00E9;

        public const int SBM_GETSCROLLINFO = 0x00EA;

        public const int SBM_GETSCROLLBARINFO= 0x00EB;

        public const int LVM_FIRST = 0x1000;// ListView messages

        public const int TV_FIRST = 0x1100;// TreeView messages

        public const int HDM_FIRST = 0x1200;// Header messages

        public const int TCM_FIRST = 0x1300;// Tab control messages

        public const int PGM_FIRST = 0x1400;// Pager control messages

        public const int ECM_FIRST = 0x1500;// Edit control messages

        public const int BCM_FIRST = 0x1600;// Button control messages

        public const int CBM_FIRST = 0x1700;// Combobox control messages

        public const int CCM_FIRST = 0x2000;// Common control shared messages

        public const int CCM_LAST =(CCM_FIRST + 0x200);

        public const int CCM_SETBKCOLOR = (CCM_FIRST + 1);

        public const int CCM_SETCOLORSCHEME = (CCM_FIRST + 2);

        public const int CCM_GETCOLORSCHEME = (CCM_FIRST + 3);

        public const int CCM_GETDROPTARGET = (CCM_FIRST + 4);

        public const int CCM_SETUNICODEFORMAT = (CCM_FIRST + 5);

        public const int CCM_GETUNICODEFORMAT = (CCM_FIRST + 6);

        public const int CCM_SETVERSION = (CCM_FIRST + 0x7);

        public const int CCM_GETVERSION = (CCM_FIRST + 0x8);

        public const int CCM_SETNOTIFYWINDOW = (CCM_FIRST + 0x9);

        public const int CCM_SETWINDOWTHEME = (CCM_FIRST + 0xb);

        public const int CCM_DPISCALE = (CCM_FIRST + 0xc);

        public const int HDM_GETITEMCOUNT = (HDM_FIRST + 0);

        public const int HDM_INSERTITEMA = (HDM_FIRST + 1);

        public const int HDM_INSERTITEMW = (HDM_FIRST + 10);

        public const int HDM_DELETEITEM = (HDM_FIRST + 2);

        public const int HDM_GETITEMA = (HDM_FIRST + 3);

        public const int HDM_GETITEMW = (HDM_FIRST + 11);

        public const int HDM_SETITEMA = (HDM_FIRST + 4);

        public const int HDM_SETITEMW = (HDM_FIRST + 12);

        public const int HDM_LAYOUT = (HDM_FIRST + 5);

        public const int HDM_HITTEST = (HDM_FIRST + 6);

        public const int HDM_GETITEMRECT = (HDM_FIRST + 7);

        public const int HDM_SETIMAGELIST = (HDM_FIRST + 8);

        public const int HDM_GETIMAGELIST = (HDM_FIRST + 9);

        public const int HDM_ORDERTOINDEX = (HDM_FIRST + 15);

        public const int HDM_CREATEDRAGIMAGE = (HDM_FIRST + 16);

        public const int HDM_GETORDERARRAY = (HDM_FIRST + 17);

        public const int HDM_SETORDERARRAY = (HDM_FIRST + 18);

        public const int HDM_SETHOTDIVIDER = (HDM_FIRST + 19);

        public const int HDM_SETBITMAPMARGIN = (HDM_FIRST + 20);

        public const int HDM_GETBITMAPMARGIN = (HDM_FIRST + 21);

        public const int HDM_SETUNICODEFORMAT = CCM_SETUNICODEFORMAT;

        public const int HDM_GETUNICODEFORMAT = CCM_GETUNICODEFORMAT;

        public const int HDM_SETFILTERCHANGETIMEOUT = (HDM_FIRST+22);

        public const int HDM_EDITFILTER = (HDM_FIRST+23);

        public const int HDM_CLEARFILTER = (HDM_FIRST+24);

        public const int TB_ENABLEBUTTON = (WM_USER + 1);

        public const int TB_CHECKBUTTON = (WM_USER + 2);

        public const int TB_PRESSBUTTON = (WM_USER + 3);

        public const int TB_HIDEBUTTON = (WM_USER + 4);

        public const int TB_INDETERMINATE = (WM_USER + 5);

        public const int TB_MARKBUTTON = (WM_USER + 6);

        public const int TB_ISBUTTONENABLED = (WM_USER + 9);

        public const int TB_ISBUTTONCHECKED = (WM_USER + 10);

        public const int TB_ISBUTTONPRESSED = (WM_USER + 11);

        public const int TB_ISBUTTONHIDDEN = (WM_USER + 12);

        public const int TB_ISBUTTONINDETERMINATE = (WM_USER + 13);

        public const int TB_ISBUTTONHIGHLIGHTED = (WM_USER + 14);

        public const int TB_SETSTATE = (WM_USER + 17);

        public const int TB_GETSTATE = (WM_USER + 18);

        public const int TB_ADDBITMAP = (WM_USER + 19);

        public const int TB_ADDBUTTONSA = (WM_USER + 20);

        public const int TB_INSERTBUTTONA = (WM_USER + 21);

        public const int TB_ADDBUTTONS = (WM_USER + 20);

        public const int TB_INSERTBUTTON = (WM_USER + 21);

        public const int TB_DELETEBUTTON = (WM_USER + 22);

        public const int TB_GETBUTTON = (WM_USER + 23);

        public const int TB_BUTTONCOUNT = (WM_USER + 24);

        public const int TB_COMMANDTOINDEX = (WM_USER + 25);

        public const int TB_SAVERESTOREA = (WM_USER + 26);

        public const int TB_SAVERESTOREW = (WM_USER + 76);

        public const int TB_CUSTOMIZE = (WM_USER + 27);

        public const int TB_ADDSTRINGA = (WM_USER + 28);

        public const int TB_ADDSTRINGW = (WM_USER + 77);

        public const int TB_GETITEMRECT = (WM_USER + 29);

        public const int TB_BUTTONSTRUCTSIZE = (WM_USER + 30);

        public const int TB_SETBUTTONSIZE = (WM_USER + 31);

        public const int TB_SETBITMAPSIZE = (WM_USER + 32);

        public const int TB_AUTOSIZE = (WM_USER + 33);

        public const int TB_GETTOOLTIPS = (WM_USER + 35);

        public const int TB_SETTOOLTIPS = (WM_USER + 36);

        public const int TB_SETPARENT = (WM_USER + 37);

        public const int TB_SETROWS = (WM_USER + 39);

        public const int TB_GETROWS = (WM_USER + 40);

        public const int TB_SETCMDID = (WM_USER + 42);

        public const int TB_CHANGEBITMAP = (WM_USER + 43);

        public const int TB_GETBITMAP = (WM_USER + 44);

        public const int TB_GETBUTTONTEXTA = (WM_USER + 45);

        public const int TB_GETBUTTONTEXTW = (WM_USER + 75);

        public const int TB_REPLACEBITMAP = (WM_USER + 46);

        public const int TB_SETINDENT = (WM_USER + 47);

        public const int TB_SETIMAGELIST = (WM_USER + 48);

        public const int TB_GETIMAGELIST = (WM_USER + 49);

        public const int TB_LOADIMAGES = (WM_USER + 50);

        public const int TB_GETRECT = (WM_USER + 51);

        public const int TB_SETHOTIMAGELIST = (WM_USER + 52);

        public const int TB_GETHOTIMAGELIST = (WM_USER + 53);

        public const int TB_SETDISABLEDIMAGELIST = (WM_USER + 54);

        public const int TB_GETDISABLEDIMAGELIST = (WM_USER + 55);

        public const int TB_SETSTYLE = (WM_USER + 56);

        public const int TB_GETSTYLE = (WM_USER + 57);

        public const int TB_GETBUTTONSIZE = (WM_USER + 58);

        public const int TB_SETBUTTONWIDTH = (WM_USER + 59);

        public const int TB_SETMAXTEXTROWS = (WM_USER + 60);

        public const int TB_GETTEXTROWS = (WM_USER + 61);

        public const int TB_GETOBJECT = (WM_USER + 62);

        public const int TB_GETHOTITEM = (WM_USER + 71);

        public const int TB_SETHOTITEM = (WM_USER + 72);

        public const int TB_SETANCHORHIGHLIGHT = (WM_USER + 73);

        public const int TB_GETANCHORHIGHLIGHT = (WM_USER + 74);

        public const int TB_MAPACCELERATORA = (WM_USER + 78);

        public const int TB_GETINSERTMARK = (WM_USER + 79);

        public const int TB_SETINSERTMARK = (WM_USER + 80);

        public const int TB_INSERTMARKHITTEST = (WM_USER + 81);

        public const int TB_MOVEBUTTON = (WM_USER + 82);

        public const int TB_GETMAXSIZE = (WM_USER + 83);

        public const int TB_SETEXTENDEDSTYLE = (WM_USER + 84);

        public const int TB_GETEXTENDEDSTYLE = (WM_USER + 85);

        public const int TB_GETPADDING = (WM_USER + 86);

        public const int TB_SETPADDING = (WM_USER + 87);

        public const int TB_SETINSERTMARKCOLOR = (WM_USER + 88);

        public const int TB_GETINSERTMARKCOLOR = (WM_USER + 89);

        public const int TB_SETCOLORSCHEME = CCM_SETCOLORSCHEME;

        public const int TB_GETCOLORSCHEME = CCM_GETCOLORSCHEME;

        public const int TB_SETUNICODEFORMAT = CCM_SETUNICODEFORMAT;

        public const int TB_GETUNICODEFORMAT = CCM_GETUNICODEFORMAT;

        public const int TB_MAPACCELERATORW = (WM_USER + 90);

        public const int TB_GETBITMAPFLAGS = (WM_USER + 41);

        public const int TB_GETBUTTONINFOW = (WM_USER + 63);

        public const int TB_SETBUTTONINFOW = (WM_USER + 64);

        public const int TB_GETBUTTONINFOA = (WM_USER + 65);

        public const int TB_SETBUTTONINFOA = (WM_USER + 66);

        public const int TB_INSERTBUTTONW = (WM_USER + 67);

        public const int TB_ADDBUTTONSW = (WM_USER + 68);

        public const int TB_HITTEST = (WM_USER + 69);

        public const int TB_SETDRAWTEXTFLAGS = (WM_USER + 70);

        public const int TB_GETSTRINGW = (WM_USER + 91);

        public const int TB_GETSTRINGA = (WM_USER + 92);

        public const int TB_GETMETRICS = (WM_USER + 101);

        public const int TB_SETMETRICS = (WM_USER + 102);

        public const int TB_SETWINDOWTHEME = CCM_SETWINDOWTHEME;

        public const int RB_INSERTBANDA = (WM_USER + 1);

        public const int RB_DELETEBAND = (WM_USER + 2);

        public const int RB_GETBARINFO = (WM_USER + 3);

        public const int RB_SETBARINFO = (WM_USER + 4);

        public const int RB_GETBANDINFO = (WM_USER + 5);

        public const int RB_SETBANDINFOA = (WM_USER + 6);

        public const int RB_SETPARENT = (WM_USER + 7);

        public const int RB_HITTEST = (WM_USER + 8);

        public const int RB_GETRECT = (WM_USER + 9);

        public const int RB_INSERTBANDW = (WM_USER + 10);

        public const int RB_SETBANDINFOW = (WM_USER + 11);

        public const int RB_GETBANDCOUNT = (WM_USER + 12);

        public const int RB_GETROWCOUNT = (WM_USER + 13);

        public const int RB_GETROWHEIGHT = (WM_USER + 14);

        public const int RB_IDTOINDEX = (WM_USER + 16);

        public const int RB_GETTOOLTIPS = (WM_USER + 17);

        public const int RB_SETTOOLTIPS = (WM_USER + 18);

        public const int RB_SETBKCOLOR = (WM_USER + 19);

        public const int RB_GETBKCOLOR = (WM_USER + 20);

        public const int RB_SETTEXTCOLOR = (WM_USER + 21);

        public const int RB_GETTEXTCOLOR = (WM_USER + 22);

        public const int RB_SIZETORECT = (WM_USER + 23);

        public const int RB_SETCOLORSCHEME = CCM_SETCOLORSCHEME;

        public const int RB_GETCOLORSCHEME = CCM_GETCOLORSCHEME;

        public const int RB_BEGINDRAG = (WM_USER + 24);

        public const int RB_ENDDRAG = (WM_USER + 25);

        public const int RB_DRAGMOVE = (WM_USER + 26);

        public const int RB_GETBARHEIGHT = (WM_USER + 27);

        public const int RB_GETBANDINFOW = (WM_USER + 28);

        public const int RB_GETBANDINFOA = (WM_USER + 29);

        public const int RB_MINIMIZEBAND = (WM_USER + 30);

        public const int RB_MAXIMIZEBAND = (WM_USER + 31);

        public const int RB_GETDROPTARGET = (CCM_GETDROPTARGET);

        public const int RB_GETBANDBORDERS = (WM_USER + 34);

        public const int RB_SHOWBAND = (WM_USER + 35);

        public const int RB_SETPALETTE = (WM_USER + 37);

        public const int RB_GETPALETTE = (WM_USER + 38);

        public const int RB_MOVEBAND = (WM_USER + 39);

        public const int RB_SETUNICODEFORMAT = CCM_SETUNICODEFORMAT;

        public const int RB_GETUNICODEFORMAT = CCM_GETUNICODEFORMAT;

        public const int RB_GETBANDMARGINS = (WM_USER + 40);

        public const int RB_SETWINDOWTHEME = CCM_SETWINDOWTHEME;

        public const int RB_PUSHCHEVRON = (WM_USER + 43);

        public const int TTM_ACTIVATE = (WM_USER + 1);

        public const int TTM_SETDELAYTIME = (WM_USER + 3);

        public const int TTM_ADDTOOLA = (WM_USER + 4);

        public const int TTM_ADDTOOLW = (WM_USER + 50);

        public const int TTM_DELTOOLA = (WM_USER + 5);

        public const int TTM_DELTOOLW = (WM_USER + 51);

        public const int TTM_NEWTOOLRECTA = (WM_USER + 6);

        public const int TTM_NEWTOOLRECTW = (WM_USER + 52);

        public const int TTM_RELAYEVENT = (WM_USER + 7);

        public const int TTM_GETTOOLINFOA = (WM_USER + 8);

        public const int TTM_GETTOOLINFOW = (WM_USER + 53);

        public const int TTM_SETTOOLINFOA = (WM_USER + 9);

        public const int TTM_SETTOOLINFOW = (WM_USER + 54);

        public const int TTM_HITTESTA = (WM_USER +10);

        public const int TTM_HITTESTW = (WM_USER +55);

        public const int TTM_GETTEXTA = (WM_USER +11);

        public const int TTM_GETTEXTW = (WM_USER +56);

        public const int TTM_UPDATETIPTEXTA = (WM_USER +12);

        public const int TTM_UPDATETIPTEXTW = (WM_USER +57);

        public const int TTM_GETTOOLCOUNT = (WM_USER +13);

        public const int TTM_ENUMTOOLSA = (WM_USER +14);

        public const int TTM_ENUMTOOLSW = (WM_USER +58);

        public const int TTM_GETCURRENTTOOLA = (WM_USER + 15);

        public const int TTM_GETCURRENTTOOLW = (WM_USER + 59);

        public const int TTM_WINDOWFROMPOINT = (WM_USER + 16);

        public const int TTM_TRACKACTIVATE = (WM_USER + 17);

        public const int TTM_TRACKPOSITION = (WM_USER + 18);

        public const int TTM_SETTIPBKCOLOR = (WM_USER + 19);

        public const int TTM_SETTIPTEXTCOLOR = (WM_USER + 20);

        public const int TTM_GETDELAYTIME = (WM_USER + 21);

        public const int TTM_GETTIPBKCOLOR = (WM_USER + 22);

        public const int TTM_GETTIPTEXTCOLOR = (WM_USER + 23);

        public const int TTM_SETMAXTIPWIDTH = (WM_USER + 24);

        public const int TTM_GETMAXTIPWIDTH = (WM_USER + 25);

        public const int TTM_SETMARGIN = (WM_USER + 26);

        public const int TTM_GETMARGIN = (WM_USER + 27);

        public const int TTM_POP = (WM_USER + 28);

        public const int TTM_UPDATE = (WM_USER + 29);

        public const int TTM_GETBUBBLESIZE = (WM_USER + 30);

        public const int TTM_ADJUSTRECT = (WM_USER + 31);

        public const int TTM_SETTITLEA = (WM_USER + 32);

        public const int TTM_SETTITLEW = (WM_USER + 33);

        public const int TTM_POPUP = (WM_USER + 34);

        public const int TTM_GETTITLE = (WM_USER + 35);

        public const int TTM_SETWINDOWTHEME = CCM_SETWINDOWTHEME;

        public const int SB_SETTEXTA = (WM_USER+1);

        public const int SB_SETTEXTW = (WM_USER+11);

        public const int SB_GETTEXTA = (WM_USER+2);

        public const int SB_GETTEXTW = (WM_USER+13);

        public const int SB_GETTEXTLENGTHA = (WM_USER+3);

        public const int SB_GETTEXTLENGTHW = (WM_USER+12);

        public const int SB_SETPARTS = (WM_USER+4);

        public const int SB_GETPARTS = (WM_USER+6);

        public const int SB_GETBORDERS = (WM_USER+7);

        public const int SB_SETMINHEIGHT = (WM_USER+8);

        public const int SB_SIMPLE = (WM_USER+9);

        public const int SB_GETRECT = (WM_USER+10);

        public const int SB_ISSIMPLE = (WM_USER+14);

        public const int SB_SETICON = (WM_USER+15);

        public const int SB_SETTIPTEXTA = (WM_USER+16);

        public const int SB_SETTIPTEXTW = (WM_USER+17);

        public const int SB_GETTIPTEXTA = (WM_USER+18);

        public const int SB_GETTIPTEXTW = (WM_USER+19);

        public const int SB_GETICON = (WM_USER+20);

        public const int SB_SETUNICODEFORMAT = CCM_SETUNICODEFORMAT;

        public const int SB_GETUNICODEFORMAT = CCM_GETUNICODEFORMAT;

        public const int SB_SETBKCOLOR = CCM_SETBKCOLOR;

        public const int SB_SIMPLEID = 0x00ff;

        public const int TBM_GETPOS = (WM_USER);

        public const int TBM_GETRANGEMIN = (WM_USER+1);

        public const int TBM_GETRANGEMAX = (WM_USER+2);

        public const int TBM_GETTIC = (WM_USER+3);

        public const int TBM_SETTIC = (WM_USER+4);

        public const int TBM_SETPOS = (WM_USER+5);

        public const int TBM_SETRANGE = (WM_USER+6);

        public const int TBM_SETRANGEMIN = (WM_USER+7);

        public const int TBM_SETRANGEMAX = (WM_USER+8);

        public const int TBM_CLEARTICS = (WM_USER+9);

        public const int TBM_SETSEL = (WM_USER+10);

        public const int TBM_SETSELSTART = (WM_USER+11);

        public const int TBM_SETSELEND = (WM_USER+12);

        public const int TBM_GETPTICS = (WM_USER+14);

        public const int TBM_GETTICPOS = (WM_USER+15);

        public const int TBM_GETNUMTICS = (WM_USER+16);

        public const int TBM_GETSELSTART = (WM_USER+17);

        public const int TBM_GETSELEND = (WM_USER+18);

        public const int TBM_CLEARSEL = (WM_USER+19);

        public const int TBM_SETTICFREQ = (WM_USER+20);

        public const int TBM_SETPAGESIZE = (WM_USER+21);

        public const int TBM_GETPAGESIZE = (WM_USER+22);

        public const int TBM_SETLINESIZE = (WM_USER+23);

        public const int TBM_GETLINESIZE = (WM_USER+24);

        public const int TBM_GETTHUMBRECT = (WM_USER+25);

        public const int TBM_GETCHANNELRECT = (WM_USER+26);

        public const int TBM_SETTHUMBLENGTH = (WM_USER+27);

        public const int TBM_GETTHUMBLENGTH = (WM_USER+28);

        public const int TBM_SETTOOLTIPS = (WM_USER+29);

        public const int TBM_GETTOOLTIPS = (WM_USER+30);

        public const int TBM_SETTIPSIDE = (WM_USER+31);

        public const int TBM_SETBUDDY = (WM_USER+32);

        public const int TBM_GETBUDDY = (WM_USER+33);

        public const int TBM_SETUNICODEFORMAT = CCM_SETUNICODEFORMAT;

        public const int TBM_GETUNICODEFORMAT = CCM_GETUNICODEFORMAT;

        public const int DL_BEGINDRAG = (WM_USER+133);

        public const int DL_DRAGGING = (WM_USER+134);

        public const int DL_DROPPED = (WM_USER+135);

        public const int DL_CANCELDRAG = (WM_USER+136);

        public const int UDM_SETRANGE = (WM_USER+101);

        public const int UDM_GETRANGE = (WM_USER+102);

        public const int UDM_SETPOS = (WM_USER+103);

        public const int UDM_GETPOS = (WM_USER+104);

        public const int UDM_SETBUDDY = (WM_USER+105);

        public const int UDM_GETBUDDY = (WM_USER+106);

        public const int UDM_SETACCEL = (WM_USER+107);

        public const int UDM_GETACCEL = (WM_USER+108);

        public const int UDM_SETBASE = (WM_USER+109);

        public const int UDM_GETBASE = (WM_USER+110);

        public const int UDM_SETRANGE32 = (WM_USER+111);

        public const int UDM_GETRANGE32 = (WM_USER+112);

        public const int UDM_SETUNICODEFORMAT = CCM_SETUNICODEFORMAT;

        public const int UDM_GETUNICODEFORMAT = CCM_GETUNICODEFORMAT;

        public const int UDM_SETPOS32 = (WM_USER+113);

        public const int UDM_GETPOS32 = (WM_USER+114);

        public const int PBM_SETRANGE = (WM_USER+1);

        public const int PBM_SETPOS = (WM_USER+2);

        public const int PBM_DELTAPOS = (WM_USER+3);

        public const int PBM_SETSTEP = (WM_USER+4);

        public const int PBM_STEPIT = (WM_USER+5);

        public const int PBM_SETRANGE32 = (WM_USER+6);

        public const int PBM_GETRANGE = (WM_USER+7);

        public const int PBM_GETPOS = (WM_USER+8);

        public const int PBM_SETBARCOLOR = (WM_USER+9);

        public const int PBM_SETBKCOLOR = CCM_SETBKCOLOR;

        public const int HKM_SETHOTKEY = (WM_USER+1);

        public const int HKM_GETHOTKEY = (WM_USER+2);

        public const int HKM_SETRULES = (WM_USER+3);

        public const int LVM_SETUNICODEFORMAT = CCM_SETUNICODEFORMAT;

        public const int LVM_GETUNICODEFORMAT = CCM_GETUNICODEFORMAT;

        public const int LVM_GETBKCOLOR = (LVM_FIRST + 0);

        public const int LVM_SETBKCOLOR = (LVM_FIRST + 1);

        public const int LVM_GETIMAGELIST = (LVM_FIRST + 2);

        public const int LVM_SETIMAGELIST = (LVM_FIRST + 3);

        public const int LVM_GETITEMCOUNT = (LVM_FIRST + 4);

        public const int LVM_GETITEMA = (LVM_FIRST + 5);

        public const int LVM_GETITEMW = (LVM_FIRST + 75);

        public const int LVM_SETITEMA = (LVM_FIRST + 6);

        public const int LVM_SETITEMW = (LVM_FIRST + 76);

        public const int LVM_INSERTITEMA = (LVM_FIRST + 7);

        public const int LVM_INSERTITEMW = (LVM_FIRST + 77);

        public const int LVM_DELETEITEM = (LVM_FIRST + 8);

        public const int LVM_DELETEALLITEMS = (LVM_FIRST + 9);

        public const int LVM_GETCALLBACKMASK = (LVM_FIRST + 10);

        public const int LVM_SETCALLBACKMASK = (LVM_FIRST + 11);

        public const int LVM_FINDITEMA = (LVM_FIRST + 13);

        public const int LVM_FINDITEMW = (LVM_FIRST + 83);

        public const int LVM_GETITEMRECT = (LVM_FIRST + 14);

        public const int LVM_SETITEMPOSITION = (LVM_FIRST + 15);

        public const int LVM_GETITEMPOSITION = (LVM_FIRST + 16);

        public const int LVM_GETSTRINGWIDTHA = (LVM_FIRST + 17);

        public const int LVM_GETSTRINGWIDTHW = (LVM_FIRST + 87);

        public const int LVM_HITTEST = (LVM_FIRST + 18);

        public const int LVM_ENSUREVISIBLE = (LVM_FIRST + 19);

        public const int LVM_SCROLL = (LVM_FIRST + 20);

        public const int LVM_REDRAWITEMS = (LVM_FIRST + 21);

        public const int LVM_ARRANGE = (LVM_FIRST + 22);

        public const int LVM_EDITLABELA = (LVM_FIRST + 23);

        public const int LVM_EDITLABELW = (LVM_FIRST + 118);

        public const int LVM_GETEDITCONTROL = (LVM_FIRST + 24);

        public const int LVM_GETCOLUMNA = (LVM_FIRST + 25);

        public const int LVM_GETCOLUMNW = (LVM_FIRST + 95);

        public const int LVM_SETCOLUMNA = (LVM_FIRST + 26);

        public const int LVM_SETCOLUMNW = (LVM_FIRST + 96);

        public const int LVM_INSERTCOLUMNA = (LVM_FIRST + 27);

        public const int LVM_INSERTCOLUMNW = (LVM_FIRST + 97);

        public const int LVM_DELETECOLUMN = (LVM_FIRST + 28);

        public const int LVM_GETCOLUMNWIDTH = (LVM_FIRST + 29);

        public const int LVM_SETCOLUMNWIDTH = (LVM_FIRST + 30);

        public const int LVM_CREATEDRAGIMAGE = (LVM_FIRST + 33);

        public const int LVM_GETVIEWRECT = (LVM_FIRST + 34);

        public const int LVM_GETTEXTCOLOR = (LVM_FIRST + 35);

        public const int LVM_SETTEXTCOLOR = (LVM_FIRST + 36);

        public const int LVM_GETTEXTBKCOLOR = (LVM_FIRST + 37);

        public const int LVM_SETTEXTBKCOLOR = (LVM_FIRST + 38);

        public const int LVM_GETTOPINDEX = (LVM_FIRST + 39);

        public const int LVM_GETCOUNTPERPAGE = (LVM_FIRST + 40);

        public const int LVM_GETORIGIN = (LVM_FIRST + 41);

        public const int LVM_UPDATE = (LVM_FIRST + 42);

        public const int LVM_SETITEMSTATE = (LVM_FIRST + 43);

        public const int LVM_GETITEMSTATE = (LVM_FIRST + 44);

        public const int LVM_GETITEMTEXTA = (LVM_FIRST + 45);

        public const int LVM_GETITEMTEXTW = (LVM_FIRST + 115);

        public const int LVM_SETITEMTEXTA = (LVM_FIRST + 46);

        public const int LVM_SETITEMTEXTW = (LVM_FIRST + 116);

        public const int LVM_SETITEMCOUNT = (LVM_FIRST + 47);

        public const int LVM_SORTITEMS = (LVM_FIRST + 48);

        public const int LVM_SETITEMPOSITION32 = (LVM_FIRST + 49);

        public const int LVM_GETSELECTEDCOUNT = (LVM_FIRST + 50);

        public const int LVM_GETITEMSPACING = (LVM_FIRST + 51);

        public const int LVM_GETISEARCHSTRINGA = (LVM_FIRST + 52);

        public const int LVM_GETISEARCHSTRINGW = (LVM_FIRST + 117);

        public const int LVM_SETICONSPACING = (LVM_FIRST + 53);

        public const int LVM_SETEXTENDEDLISTVIEWSTYLE = (LVM_FIRST + 54);

        public const int LVM_GETEXTENDEDLISTVIEWSTYLE = (LVM_FIRST + 55);

        public const int LVM_GETSUBITEMRECT = (LVM_FIRST + 56);

        public const int LVM_SUBITEMHITTEST = (LVM_FIRST + 57);

        public const int LVM_SETCOLUMNORDERARRAY = (LVM_FIRST + 58);

        public const int LVM_GETCOLUMNORDERARRAY = (LVM_FIRST + 59);

        public const int LVM_SETHOTITEM = (LVM_FIRST + 60);

        public const int LVM_GETHOTITEM = (LVM_FIRST + 61);

        public const int LVM_SETHOTCURSOR = (LVM_FIRST + 62);

        public const int LVM_GETHOTCURSOR = (LVM_FIRST + 63);

        public const int LVM_APPROXIMATEVIEWRECT = (LVM_FIRST + 64);

        public const int LVM_SETWORKAREAS = (LVM_FIRST + 65);

        public const int LVM_GETWORKAREAS = (LVM_FIRST + 70);

        public const int LVM_GETNUMBEROFWORKAREAS = (LVM_FIRST + 73);

        public const int LVM_GETSELECTIONMARK = (LVM_FIRST + 66);

        public const int LVM_SETSELECTIONMARK = (LVM_FIRST + 67);

        public const int LVM_SETHOVERTIME = (LVM_FIRST + 71);

        public const int LVM_GETHOVERTIME = (LVM_FIRST + 72);

        public const int LVM_SETTOOLTIPS = (LVM_FIRST + 74);

        public const int LVM_GETTOOLTIPS = (LVM_FIRST + 78);

        public const int LVM_SORTITEMSEX = (LVM_FIRST + 81);

        public const int LVM_SETBKIMAGEA = (LVM_FIRST + 68);

        public const int LVM_SETBKIMAGEW = (LVM_FIRST + 138);

        public const int LVM_GETBKIMAGEA = (LVM_FIRST + 69);

        public const int LVM_GETBKIMAGEW = (LVM_FIRST + 139);

        public const int LVM_SETSELECTEDCOLUMN = (LVM_FIRST + 140);

        public const int LVM_SETTILEWIDTH = (LVM_FIRST + 141);

        public const int LVM_SETVIEW = (LVM_FIRST + 142);

        public const int LVM_GETVIEW = (LVM_FIRST + 143);

        public const int LVM_INSERTGROUP = (LVM_FIRST + 145);

        public const int LVM_SETGROUPINFO = (LVM_FIRST + 147);

        public const int LVM_GETGROUPINFO = (LVM_FIRST + 149);

        public const int LVM_REMOVEGROUP = (LVM_FIRST + 150);

        public const int LVM_MOVEGROUP = (LVM_FIRST + 151);

        public const int LVM_MOVEITEMTOGROUP = (LVM_FIRST + 154);

        public const int LVM_SETGROUPMETRICS = (LVM_FIRST + 155);

        public const int LVM_GETGROUPMETRICS = (LVM_FIRST + 156);

        public const int LVM_ENABLEGROUPVIEW = (LVM_FIRST + 157);

        public const int LVM_SORTGROUPS = (LVM_FIRST + 158);

        public const int LVM_INSERTGROUPSORTED = (LVM_FIRST + 159);

        public const int LVM_REMOVEALLGROUPS = (LVM_FIRST + 160);

        public const int LVM_HASGROUP = (LVM_FIRST + 161);

        public const int LVM_SETTILEVIEWINFO = (LVM_FIRST + 162);

        public const int LVM_GETTILEVIEWINFO = (LVM_FIRST + 163);

        public const int LVM_SETTILEINFO = (LVM_FIRST + 164);

        public const int LVM_GETTILEINFO = (LVM_FIRST + 165);

        public const int LVM_SETINSERTMARK = (LVM_FIRST + 166);

        public const int LVM_GETINSERTMARK = (LVM_FIRST + 167);

        public const int LVM_INSERTMARKHITTEST = (LVM_FIRST + 168);

        public const int LVM_GETINSERTMARKRECT = (LVM_FIRST + 169);

        public const int LVM_SETINSERTMARKCOLOR = (LVM_FIRST + 170);

        public const int LVM_GETINSERTMARKCOLOR = (LVM_FIRST + 171);

        public const int LVM_SETINFOTIP = (LVM_FIRST + 173);

        public const int LVM_GETSELECTEDCOLUMN = (LVM_FIRST + 174);

        public const int LVM_ISGROUPVIEWENABLED = (LVM_FIRST + 175);

        public const int LVM_GETOUTLINECOLOR = (LVM_FIRST + 176);

        public const int LVM_SETOUTLINECOLOR = (LVM_FIRST + 177);

        public const int LVM_CANCELEDITLABEL = (LVM_FIRST + 179);

        public const int LVM_MAPINDEXTOID = (LVM_FIRST + 180);

        public const int LVM_MAPIDTOINDEX = (LVM_FIRST + 181);

        public const int TVM_INSERTITEMA = (TV_FIRST + 0);

        public const int TVM_INSERTITEMW = (TV_FIRST + 50);

        public const int TVM_DELETEITEM = (TV_FIRST + 1);

        public const int TVM_EXPAND = (TV_FIRST + 2);

        public const int TVM_GETITEMRECT = (TV_FIRST + 4);

        public const int TVM_GETCOUNT = (TV_FIRST + 5);

        public const int TVM_GETINDENT = (TV_FIRST + 6);

        public const int TVM_SETINDENT = (TV_FIRST + 7);

        public const int TVM_GETIMAGELIST = (TV_FIRST + 8);

        public const int TVM_SETIMAGELIST = (TV_FIRST + 9);

        public const int TVM_GETNEXTITEM = (TV_FIRST + 10);

        public const int TVM_SELECTITEM = (TV_FIRST + 11);

        public const int TVM_GETITEMA = (TV_FIRST + 12);

        public const int TVM_GETITEMW = (TV_FIRST + 62);

        public const int TVM_SETITEMA = (TV_FIRST + 13);

        public const int TVM_SETITEMW = (TV_FIRST + 63);

        public const int TVM_EDITLABELA = (TV_FIRST + 14);

        public const int TVM_EDITLABELW = (TV_FIRST + 65);

        public const int TVM_GETEDITCONTROL = (TV_FIRST + 15);

        public const int TVM_GETVISIBLECOUNT = (TV_FIRST + 16);

        public const int TVM_HITTEST = (TV_FIRST + 17);

        public const int TVM_CREATEDRAGIMAGE = (TV_FIRST + 18);

        public const int TVM_SORTCHILDREN = (TV_FIRST + 19);

        public const int TVM_ENSUREVISIBLE = (TV_FIRST + 20);

        public const int TVM_SORTCHILDRENCB = (TV_FIRST + 21);

        public const int TVM_ENDEDITLABELNOW = (TV_FIRST + 22);

        public const int TVM_GETISEARCHSTRINGA = (TV_FIRST + 23);

        public const int TVM_GETISEARCHSTRINGW = (TV_FIRST + 64);

        public const int TVM_SETTOOLTIPS = (TV_FIRST + 24);

        public const int TVM_GETTOOLTIPS = (TV_FIRST + 25);

        public const int TVM_SETINSERTMARK = (TV_FIRST + 26);

        public const int TVM_SETUNICODEFORMAT = CCM_SETUNICODEFORMAT;

        public const int TVM_GETUNICODEFORMAT = CCM_GETUNICODEFORMAT;

        public const int TVM_SETITEMHEIGHT = (TV_FIRST + 27);

        public const int TVM_GETITEMHEIGHT = (TV_FIRST + 28);

        public const int TVM_SETBKCOLOR = (TV_FIRST + 29);

        public const int TVM_SETTEXTCOLOR = (TV_FIRST + 30);

        public const int TVM_GETBKCOLOR = (TV_FIRST + 31);

        public const int TVM_GETTEXTCOLOR = (TV_FIRST + 32);

        public const int TVM_SETSCROLLTIME = (TV_FIRST + 33);

        public const int TVM_GETSCROLLTIME = (TV_FIRST + 34);

        public const int TVM_SETINSERTMARKCOLOR = (TV_FIRST + 37);

        public const int TVM_GETINSERTMARKCOLOR = (TV_FIRST + 38);

        public const int TVM_GETITEMSTATE = (TV_FIRST + 39);

        public const int TVM_SETLINECOLOR = (TV_FIRST + 40);

        public const int TVM_GETLINECOLOR = (TV_FIRST + 41);

        public const int TVM_MAPACCIDTOHTREEITEM = (TV_FIRST + 42);

        public const int TVM_MAPHTREEITEMTOACCID = (TV_FIRST + 43);

        public const int CBEM_INSERTITEMA = (WM_USER + 1);

        public const int CBEM_SETIMAGELIST = (WM_USER + 2);

        public const int CBEM_GETIMAGELIST = (WM_USER + 3);

        public const int CBEM_GETITEMA = (WM_USER + 4);

        public const int CBEM_SETITEMA = (WM_USER + 5);

        public const int CBEM_DELETEITEM = CB_DELETESTRING;

        public const int CBEM_GETCOMBOCONTROL = (WM_USER + 6);

        public const int CBEM_GETEDITCONTROL = (WM_USER + 7);

        public const int CBEM_SETEXTENDEDSTYLE = (WM_USER + 14);

        public const int CBEM_GETEXTENDEDSTYLE = (WM_USER + 9);

        public const int CBEM_SETUNICODEFORMAT = CCM_SETUNICODEFORMAT;

        public const int CBEM_GETUNICODEFORMAT = CCM_GETUNICODEFORMAT;

        public const int CBEM_SETEXSTYLE = (WM_USER + 8);

        public const int CBEM_GETEXSTYLE = (WM_USER + 9);

        public const int CBEM_HASEDITCHANGED = (WM_USER + 10);

        public const int CBEM_INSERTITEMW = (WM_USER + 11);

        public const int CBEM_SETITEMW = (WM_USER + 12);

        public const int CBEM_GETITEMW = (WM_USER + 13);

        public const int TCM_GETIMAGELIST = (TCM_FIRST + 2);

        public const int TCM_SETIMAGELIST = (TCM_FIRST + 3);

        public const int TCM_GETITEMCOUNT = (TCM_FIRST + 4);

        public const int TCM_GETITEMA = (TCM_FIRST + 5);

        public const int TCM_GETITEMW = (TCM_FIRST + 60);

        public const int TCM_SETITEMA = (TCM_FIRST + 6);

        public const int TCM_SETITEMW = (TCM_FIRST + 61);

        public const int TCM_INSERTITEMA = (TCM_FIRST + 7);

        public const int TCM_INSERTITEMW = (TCM_FIRST + 62);

        public const int TCM_DELETEITEM = (TCM_FIRST + 8);

        public const int TCM_DELETEALLITEMS = (TCM_FIRST + 9);

        public const int TCM_GETITEMRECT = (TCM_FIRST + 10);

        public const int TCM_GETCURSEL = (TCM_FIRST + 11);

        public const int TCM_SETCURSEL = (TCM_FIRST + 12);

        public const int TCM_HITTEST = (TCM_FIRST + 13);

        public const int TCM_SETITEMEXTRA = (TCM_FIRST + 14);

        public const int TCM_ADJUSTRECT = (TCM_FIRST + 40);

        public const int TCM_SETITEMSIZE = (TCM_FIRST + 41);

        public const int TCM_REMOVEIMAGE = (TCM_FIRST + 42);

        public const int TCM_SETPADDING = (TCM_FIRST + 43);

        public const int TCM_GETROWCOUNT = (TCM_FIRST + 44);

        public const int TCM_GETTOOLTIPS = (TCM_FIRST + 45);

        public const int TCM_SETTOOLTIPS = (TCM_FIRST + 46);

        public const int TCM_GETCURFOCUS = (TCM_FIRST + 47);

        public const int TCM_SETCURFOCUS = (TCM_FIRST + 48);

        public const int TCM_SETMINTABWIDTH = (TCM_FIRST + 49);

        public const int TCM_DESELECTALL = (TCM_FIRST + 50);

        public const int TCM_HIGHLIGHTITEM = (TCM_FIRST + 51);

        public const int TCM_SETEXTENDEDSTYLE = (TCM_FIRST + 52);

        public const int TCM_GETEXTENDEDSTYLE = (TCM_FIRST + 53);

        public const int TCM_SETUNICODEFORMAT = CCM_SETUNICODEFORMAT;

        public const int TCM_GETUNICODEFORMAT = CCM_GETUNICODEFORMAT;

        public const int ACM_OPENA = (WM_USER+100);

        public const int ACM_OPENW = (WM_USER+103);

        public const int ACM_PLAY = (WM_USER+101);

        public const int ACM_STOP = (WM_USER+102);

        public const int MCM_FIRST = 0x1000;

        public const int MCM_GETCURSEL = (MCM_FIRST + 1);

        public const int MCM_SETCURSEL = (MCM_FIRST + 2);

        public const int MCM_GETMAXSELCOUNT = (MCM_FIRST + 3);

        public const int MCM_SETMAXSELCOUNT = (MCM_FIRST + 4);

        public const int MCM_GETSELRANGE = (MCM_FIRST + 5);

        public const int MCM_SETSELRANGE = (MCM_FIRST + 6);

        public const int MCM_GETMONTHRANGE = (MCM_FIRST + 7);

        public const int MCM_SETDAYSTATE = (MCM_FIRST + 8);

        public const int MCM_GETMINREQRECT = (MCM_FIRST + 9);

        public const int MCM_SETCOLOR = (MCM_FIRST + 10);

        public const int MCM_GETCOLOR = (MCM_FIRST + 11);

        public const int MCM_SETTODAY = (MCM_FIRST + 12);

        public const int MCM_GETTODAY = (MCM_FIRST + 13);

        public const int MCM_HITTEST = (MCM_FIRST + 14);

        public const int MCM_SETFIRSTDAYOFWEEK = (MCM_FIRST + 15);

        public const int MCM_GETFIRSTDAYOFWEEK = (MCM_FIRST + 16);

        public const int MCM_GETRANGE = (MCM_FIRST + 17);

        public const int MCM_SETRANGE = (MCM_FIRST + 18);

        public const int MCM_GETMONTHDELTA = (MCM_FIRST + 19);

        public const int MCM_SETMONTHDELTA = (MCM_FIRST + 20);

        public const int MCM_GETMAXTODAYWIDTH = (MCM_FIRST + 21);

        public const int MCM_SETUNICODEFORMAT = CCM_SETUNICODEFORMAT;

        public const int MCM_GETUNICODEFORMAT = CCM_GETUNICODEFORMAT;

        public const int DTM_FIRST = 0x1000;

        public const int DTM_GETSYSTEMTIME = (DTM_FIRST + 1);

        public const int DTM_SETSYSTEMTIME = (DTM_FIRST + 2);

        public const int DTM_GETRANGE = (DTM_FIRST + 3);

        public const int DTM_SETRANGE = (DTM_FIRST + 4);

        public const int DTM_SETFORMATA = (DTM_FIRST + 5);

        public const int DTM_SETFORMATW = (DTM_FIRST + 50);

        public const int DTM_SETMCCOLOR = (DTM_FIRST + 6);

        public const int DTM_GETMCCOLOR = (DTM_FIRST + 7);

        public const int DTM_GETMONTHCAL = (DTM_FIRST + 8);

        public const int DTM_SETMCFONT = (DTM_FIRST + 9);

        public const int DTM_GETMCFONT = (DTM_FIRST + 10);

        public const int PGM_SETCHILD = (PGM_FIRST + 1);

        public const int PGM_RECALCSIZE = (PGM_FIRST + 2);

        public const int PGM_FORWARDMOUSE = (PGM_FIRST + 3);

        public const int PGM_SETBKCOLOR = (PGM_FIRST + 4);

        public const int PGM_GETBKCOLOR = (PGM_FIRST + 5);

        public const int PGM_SETBORDER = (PGM_FIRST + 6);

        public const int PGM_GETBORDER = (PGM_FIRST + 7);

        public const int PGM_SETPOS = (PGM_FIRST + 8);

        public const int PGM_GETPOS = (PGM_FIRST + 9);

        public const int PGM_SETBUTTONSIZE = (PGM_FIRST + 10);

        public const int PGM_GETBUTTONSIZE = (PGM_FIRST + 11);

        public const int PGM_GETBUTTONSTATE = (PGM_FIRST + 12);

        public const int PGM_GETDROPTARGET = CCM_GETDROPTARGET;

        public const int BCM_GETIDEALSIZE = (BCM_FIRST + 0x0001);

        public const int BCM_SETIMAGELIST = (BCM_FIRST + 0x0002);

        public const int BCM_GETIMAGELIST = (BCM_FIRST + 0x0003);

        public const int BCM_SETTEXTMARGIN = (BCM_FIRST + 0x0004);

        public const int BCM_GETTEXTMARGIN = (BCM_FIRST + 0x0005);

        public const int EM_SETCUEBANNER = (ECM_FIRST + 1);

        public const int EM_GETCUEBANNER = (ECM_FIRST + 2);

        public const int EM_SHOWBALLOONTIP = (ECM_FIRST + 3);

        public const int EM_HIDEBALLOONTIP = (ECM_FIRST + 4);

        public const int CB_SETMINVISIBLE = (CBM_FIRST + 1);

        public const int CB_GETMINVISIBLE = (CBM_FIRST + 2);

        public const int LM_HITTEST = (WM_USER + 0x300);

        public const int LM_GETIDEALHEIGHT = (WM_USER + 0x301);

        public const int LM_SETITEM = (WM_USER + 0x302);

        public const int LM_GETITEM = (WM_USER + 0x303);

    }

 

------------------------------

 

    public class MouseMasks

    {

        public const int MK_NULL = 0x0000;

        public const int MK_LBUTTON = 0x0001;

        public const int MK_RBUTTON = 0x0002;

        public const int MK_SHIFT = 0x0004;

        public const int MK_CONTROL = 0x0008;

        public const int MK_MBUTTON = 0x0010;

        public const int MK_XBUTTON1 = 0x0020;

        public const int MK_XBUTTON2 = 0x0040;

    }

 

-----------------------------

 

이 정도면 가능할 것 같습니다.


출처 : http://cafe.naver.com/koreapyj.cafe?iframe_url=/ArticleRead.nhn%3Farticleid=303

반응형

'Programming > C#' 카테고리의 다른 글

C# IME (Input Method Editor) asian language support?  (0) 2010.09.03
C#을 이용한 사용자 정의 Event 구성  (0) 2010.09.02
환경 변수  (0) 2010.09.01
String과 string의 차이..??  (0) 2010.08.27
DataGridView 활용 Tip  (0) 2010.08.19
Posted by blueasa
, |

환경 변수

Programming/C# / 2010. 9. 1. 14:04

using System;

public class 환경변수
{
    public static void Main()
    {
         /// 교재 389p
        Console.WriteLine( Environment.SystemDirectory ); //시스템폴더
        Console.WriteLine( Environment.Version ); // 닷넷기준버전:2.0.50727
        Console.WriteLine( Environment.OSVersion ); //운영체제 버전
        Console.WriteLine( Environment.MachineName ); //컴퓨터명
        Console.WriteLine( Environment.UserName ); //사용자명
        Console.WriteLine( Environment.CurrentDirectory ); //현재 폴더
        Console.WriteLine( Environment.GetFolderPath
            (Environment.SpecialFolder.MyDocuments)); //내문서 폴더
    }
}

 

[출처] 환경변수|작성자 앙기

반응형
Posted by blueasa
, |
반응형
Posted by blueasa
, |

 
<컨트롤 속성>
DataGridView ID: dbView
 
1. 홀수행을 다른 색으로 보여주고 싶을 때
행마다 특정 배경색을 입혀보고 싶은 분들은 다음과 같이 구현하시면 됩니다. 일단 홀수행을 기준으로 설명하자면 AlternatiogRowsDefaultCellStyle속성에 BackColor를 선언하여 색상을 지정하시면 됩니다.
 
dbView.AlternatingRowsDefaultCellStyle.BackColor = Color.Aqua;
 
2. 여러개의 열이나 행을 선택하지 못하도록 막고 싶을 때
기본적으로 여러개의 열과 행을 선택할 수 있는데 이를 막고 한개의 열이나 한개의 행만 선택하도록 하고 싶을 때 다음과 같이 선언하면 됩니다.
 
dbView.MultiSelect = false;
 
3. 행단위로 클릭하도록 만들고 싶을 때
기본적으로 열단위로 클릭하도록 처리되어 있는데 이를 행단위로 클릭할 수 있는 기능도 있습니다. 이 기능은 SelectionMode속성에 DataGridViewSelectionMode.FullRowSelect를 설정하면 간단하게 됩니다.
 
dbView.SelectionMode = DataGridViewSelectMode.FullRowSelect;
 
참고로 DataGridViewSelectMode열거체이외의 값도 설정하여 열단위로 선택기능을 구현할 수 있고 열단위로 선택기능을 사용시 각 열에 대한 SortMode속성이 Automatic값(기본)으로 설정이 안되어 있으면 사용할 수 없습니다.
 
4. 행번호 보여주고 싶을 때
각 행의 행번호를 보여주고 싶을 때에는 행을 화면에 보여주는 타이밍인 RowPostPaint이벤트 타이밍에 그 행의 인덱스번호+1형태로 행헤더의 열 안에 넣어주면 끝납니다.
RowPostPaint이벤트핸들러의 2번째 파라미터인 DataGridViewRowPostPaintEventArgs 객체로부터 보여주기 위해 필요한 Graphics객체나 좌표값을 얻을 수 있습니다.
이하 e변수로 받을 수 있는 객체에 대해서 알아보면 다음과 같습니다.
 
<DataGridViewRowPostPaintEventArgs 객체>
  * e.Graphics - Graphics객체
  * e.RowIndex - 표시중인 행번호 (0부터 시작하기 떄문에 +1필요) 
  * e.RowBounds.X 행헤더 열 왼쪽 위 X좌표
  * e.RowBounds.Y 행헤더 열 왼쪽 위 Y좌표
  * e.RowBounds.Height 행헤더 열높이
  * dbView.RowHeadersWidth 행헤더 셀 폭
  * dbView.RowHeadersDefaultCellStyle.Font 사용폰트
  * dbView.RowHeadersDefaultCellStyle.FontColor 폰트 색상
  
private void dbView_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e) {
     // RowPointPaint 이벤트핸들러
     // 행헤더 열영역에 행번호를 보여주기 위해 장방형으로 처리
     Rectangle rect = new Rectangle(e.RowBounds.Location.X,
                         e.RowBounds.Location.Y,
                         dbView.RowHeadersWidth - 4,
                         e.RowBounds.Height);
     // 위에서 생성된 장방형내에 행번호를 보여주고 폰트색상 및 배경을 설정
     TextRenderer.DrawText(e.Graphics,
                         (e.RowIndex + 1).ToString(), 
                         dbView.RowHeadersDefaultCellStyle.Font,
                         rect,  
                         dbView.RowHeadersDefaultCellStyle.ForeColor,
                         TextFormatFlags.VerticalCenter | TextFormatFlags.Right);
}
 
5. 특정 행이나 열을 고정시키고 스크롤하지 못하도록 막고 싶을 때
여기서는 2번째 열을 고정시킨 경우를 보여주고 있는데 그리드를 옆으로 스크롤 할 경우 3번째 열보다 우측의 스크롤이 나오고 1번째열과 2번째열은 고정된 형태를 보여줍니다.
 
- Frozen 속성 : 열 고정시키기 위한 속성으로 이를 고정시키기 위한 열을 지정하고 true값을 선언하면 해당 열의 좌측 열은 전부 고정되어 스크롤 할 없게 됩니다.
 
dbView.Columns[1].Frozen = true;
 
- DividerWidth 속성 : 구분선 폭 변경을 할 때 사용하는 속성으로서 이를 통해서 2번째열과 3번째열 사이 구분선을 약간 두껍게 표현하여 보다 직관적으로 구분할 수 있습니다.
 
dbView.Columns[1].DividerWidth = 3;
 
6. 그리드 실행될 때 기본 열이 선택된 모습을 보여주고 싶지 않을 때
아주 간단하게 속성하나만 선언하면 되는데 이때 주의해야할 점은 폼_Load이벤트핸들러에서는 효과가 없다는 것입니다. 어느 열도 선택되지 않는 상태로 보여주기 위해서는 폼이 표시된 이후 한번만 발생하는 폼_Shown 이벤트핸들러에서 선언해주는 것이 좋습니다.
 
        private void Form1_Shown(object sender, EventArgs e)
        {
            //6. 그리드 실행될 때 기본 열이 선택된 모습을 보여주고 싶지 않을 때
            dbView.CurrentCell = null;
        }
 
7. 특정값을 가진 열을 좀 다르게 보여주고 싶을 때
특정값을 가진 열을 좀더 강조하여 보여주고 싶은 경우가 종종 생깁니다. 이럴 때 유용한 것으로 예제에서는 Bike란 단어가 포함된 열인 경우 빨간색으로 글씨를 보여주도록 설정하였습니다.
특히, 개별적인 열에 대해서 보여주기 위해서는 폼_CellFormating이벤트핸들러를 이용하면 될것같습니다. 본래 이 이벤트핸들러는 특정값을 가진 열의 독립적인 서식을 적용하기 위한 것으로 열 스타일만 변경할 수 있습니다.
CellFormmating이벤트핸들러의 2번째파라미터로 받는 DataGridViewCellFormattingEventArgs객체로부터 그 열의 현재 스타일이나 열의 값을 얻거나 설정할 수 있습니다. 즉, 이것을 통해 열의 값을 확인하고 그 스타일을 변경하는 형태로 개발을 해보려고 합니다. 또한, 이벤트 발생시 열위치는 ColumnIndex속성과 RowIndex속성으로 알 수 있습니다.
 
private void dbView_CellFormatting(object sender,
DataGridViewCellFormattingEventArgs e) {
{
      // 7. 특정값을 가진 열을 좀 다르게 보여주고 싶을 때
      if (e.ColumnIndex == 1)
      {
            if (e.Value != null)
            {
                 string text = e.Value.ToString();
                 if (text.Contains("Bike"))
                 {
                      e.CellStyle.ForeColor = Color.Red;
                      e.CellStyle.SelectionForeColor = Color.Red;
                  }
              }
         }
  }
 
8. 헤더열이나 헤더행의 색을 변경하고 싶을 때
헤더행과 헤더열의 색을 변경하고싶은 경우에는 ColumnHeadersDefaultCellStyle속성과 RowHeadersDefaultCellStyle속성을 사용하면 괜찮을 것같습니다.
 
dbView.ColumnHeadersDefaultCellStyle.BackColor = Color.RosyBrown;
dbView.RowHeadersDefaultCellStyle.BackColor = Color.SeaGreen;
 
단, 위와 같이 선언하여도 그것이 사용할 수 없는 경우가 있는데 이것은 애플리케이션이 적용하고 있는 Windows XP의 Visual 스타일을 우선적으로 사용하기 때문인데 이 코드는 윈폼을 만들 때 자동으로생성하기 때문에 Application클래스의 EnableVisualStyles메소드를 호출합니다.
 
dbView.EnableHeadersVisualStyles = false;
 
그외 열과 행의 사이에 있는 선스타일을 변경할 수 있는데 다음과 같이 선언하게 되면 한개의 라인으로 보여주게 됩니다.
 
dbView.RowHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single;
dbView.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single;
 
9. 선택한 행이나 열에 대한 값을 확인하고 싶을 때
보통 특정 행을 추가하거나 삭제하고 편집도 하는데 이럴 때 선택된 행이나 열에 대해서 어떤 조작을 하는 경우도 많습니다. 그래서 이번에는 이를 간단하게 처리하는 방법에 대해서 정리해보았습니다. 이 부분에 대한 것을 사용형태만 설명하고 넘어가겟습니다.
 
아래에서 설명한 것들중에서 같은 클래스명이나 속성명이 Row가 들어가거나 Column이란 단어로 비교되는 것을 알 수 있는데 이것에 의해 열에 대한 행과 똑같은 조작을 할 수 있다는 것을 알 수 있습니다.
 
- 선택된 열 얻기 : SelectedCells 속성
현재 선택된 열은 SelectedCells속성으로 얻을 수 있고 그리드에서 여러개의 열을 동시에 선택할 수 있기 때문에 이 속성은 DataGridViewSelectedCellCollection클래스 객체로 되어 잇습니다. 여기서는 간단하게 하나의 열을 조작할 경우에 사용되는 형태를 보여줍니다.
 
foreach (DataGridViewCell cell in dbView.SelectedCells) { }
 
선택된 열 갯수 얻기을 얻어 위에서 선택된 열을 얻을 수 있는 방법도 있습니다.
 SelectedCells.Count
for(int i=0; i<dbView.SelectedCells.Count; i++) { }
 
또한 MultiSelect속성을 false를 설정한 것은 사용자가 여러개의 행/열을 선택할 수 있도록 할 수 있습니다.
 
- 선택된 행 얻기 : SelectedRows 속성
행을 선택하여 행정보를 얻는 경우에 필요한 것으로 DataGridViewRow클래스의 객체의 컬렉션은 Selectedows속성으로 얻을 수 있습니다.
 
foreach(DataGridViewRow row in dbView.SelectedRows) { }
 
- 특정 셀이나 행이 선택되었는지 확인하는 경우 : Selected 속성
셀이 선택되었다면 true, 셀이 선택되지 않았다면 false로 결과를 보내줍니다.
 
dbView[x,y].Selected;
 
특정 행이 선택되었는지 확인하는 경우
 
dbView.Rows[n].Selected;
 
- 선택된 행이나 열 설정
데이터 새로고침등의 이벤트로 인해 데이터를 새롭게 보여줄때 현재 위치를 나타내고 싶은 경우에 필요한 것으로 (x,y)위치에 있는 열을 선택한 상태로 두고 싶다면 다음과 같이 선언합니다.
 
dbView[x,y].Selected = true;
 
n행의 행을 선택한 상태로 두고 싶은 경우에는 아래와 같이 선언합니다.
 
dbView.Rows[n].Selected = true;
 
- 모든 선택된 열을 지울 때 : ClearSelection 메소드
 
10. 열에 보여지는 문자열을 여러행으로 보여주고 싶을 때
열에 표시되는 문자열이 길게 되면 한줄로 보여주지만 오버되면 잘려서 안보여줍니다. 이는 열스타일의 WrapMode속성을 DataGridViewTriState.True(그외 False, NotSet)로 설정하여 셀크기안에서 오버되면 여러행으로 해당 텍스트등을 모두 보여줍니다.
그리드안의 모든 열을 여러행을 보여주고 싶다면, DefaultCellStyle속성의 WrapMode속성에 DataGridViewTriState.True를 설정하는 것을 권장합니다. 이렇게하면 정말 간단하게 구현이 됩니다. ^^
또한, 다음줄로 넘어간 문자열이 발생하면 행의 높이는 자동으로 조절되는데 AutoSizeRowMode속성에 DataGridViewAutoSizeRowsMode.AllCells를 설정할 것을 권장합니다. 이상 이 두가지를 정리하면 다음과 같습니다.
 
dbView.DefaultCellStyle.WrapMode = DataGridViewTriState.True;
dbView.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells;
 
11. 맨 밑까지 스크롤하고 싶을 때
보통 맨 밑에 있는 행을 합계로 보여주거나 응용프로그램 실행시 곧바로 사용자가 새 행을 추가할 있도록 하는 경우가 있는데 이럴때 그리드 맨밑까지 스크롤을 가볍게 해줄 필요가 있습니다. 열단위 표시를 스크롤하기 위한 속성이 3가지가 있는데 다음과 같습니다.
 
<속성>
FirstDisplayedCell 그리드 왼쪽 위에 표시된 열 얻기/설정
FirstDisplayedScrollingColumnIndex 그리드에 표시된 처음 열 얻기/설정
FirstDisplayedScrollingRowIndex 그리에 표시된 처음 행 얻기/설정
 
예를 들어 [2,15]의 위치에 있는 열을 FirstDisplayedCell속성으로 설정하면 [2,15]위치의 열에 왼쪽위로 그리드가 스크롤된 상태로 보여집니다.
 
dbView.FirstDisplayedCell = dbView[2,15];
 
마지막 행을 표시하기 위해 그리드 맨밑까지 스크롤시키려면 FirstDisplayedScrollingRowIndex속성을 이용하길 권장합니다.
 
dbView.FirstDisplayedScrollingRowIndex = dbView.Rows.Count - 1;
 
12. 오토컴플릿 기능을 사용하고 싶을 때
텍스트박스 열은 열 편집 및 새 행을 추가시 텍스트박스를 사용합니다. 이럴때 열편집시 오토컴플릿 기능을 사용할 수 있다는 점입니다.
이는 열이 편집상태가 될 때 발생하는 EditingControlShowing이벤트핸들러가 발생할 때 보여주고 있는 텍스트박스 객체를 얻어 오토컴플릿에 필요한 속성을 설장하는 형태입니다.
실제 이 텍스트박스는 DataGridViewTextBoxEditingControl 클래스의 인스턴스를 만들어 TextBox클래스의 파생클래스로서 TextBox형으로 케스팅합니다.
이렇게 예고로 내놓은 코드는 모든 텍스트박스에 대한 오토컴플릿기능을 설정하고 있기 때문에 어느 열을 사용하더라도 오토컴플릿기능이 작동되며 특정열만 오토컴플릿 기능을 지정할 수도 있습니다. 이 예제에서는
 
 private void dbView_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
 {
        TextBox tb = e.Control as TextBox;
        if (tb == null)
        {
             return;
         }
        if (dbView.CurrentCell.ColumnIndex == 1)
        {
             tb.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
             tb.AutoCompleteSource = AutoCompleteSource.AllSystemSources;
         }
         else
         {
             tb.AutoCompleteMode = AutoCompleteMode.None;
         }
  }  
 
13. 열안에 문자열 선택하고 싶을 때
열 안에의 문자열을 선택하여 처리하고 싶다면 BeginEdit메소드를 사용하는 것을 권장합니다. 이 이름처럼 열을 편집하기 위한 것으로 파라미터값을 true로 선언하면 열 안의 문자열이 선택된 상태로 편집할 수 있습니다. 만약 false로 선언하면 커서가 문자열은 선택하지 않고 문자열끝에 커서가 있는 상태로 조작을 할 수 있습니다.
 
 // 폼_Load이벤트핸들러가 BeginEdit를 호출할 경우 폼을 먼저 표시할 필요가 있음
 this.Show();
 // 2행 1열 열을 현재 열로 지정
 dbView.CurrentCell = dbView[0, 1];
 // 현재 열을 편집상태로
 dbView.BeginEdit(true);
 
14. 왼쪽 윗 빈 열에 값 설정하고 싶을 때
왼쪽 맨 윗열은 항상 빈 여백의 열로 남아 있는데 여기에 특정한 표시를 나타내기 위해 값을 넣거나 열 스타일을 변경할 수 있습니다.
이 빈열은 DataGridView컨트롤의 TopLeftHeaderCell속성으로 접근할 수 있고 이 속성값은 헤더 행이나 헤더 열과 동일한 DataGridViewHeaderCell클래스의 객체입니다. 일반적인 열을 나타내는 DataGridViewCell클래스를 상속받은 클래스입니다.
 
dbView.TopLeftHeaderCell.Value = "매장";
 
15. 오른쪽버튼 클릭시 열 선택을 할 수 있도록 하고 싶을 때
기본적으로 마우스 오른쪽버튼으로 클릭시 어떠한 조작도 제어되지 않습니다. 그래서 간단하게 클릭시 열을 선택할 수 있도록 하는 방법을 추가해보고자 합니다.
이는 CellMouseClick이벤트핸들러를 생성하여 열을 클릭시 Control클래스로 정의되어 있는 MouseClick이벤트가 추가되어 CellMouseClick이벤트핸들러가 발생하는 형태입니다. 이 이벤트핸들러의 파라미터로는 클릭된 열의 행번호와 열번호를 얻을 있어 클릭되어 진 열을 간단하게 접근하실 수 있습니다.
여기서 보여주는 스타일은 이벤트핸들러를 통해 클릭된 열의 선택상태를 알려주는 것을 아주 간단합니다.
 
 private void dbView_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e) {
      //오른쪽 버튼 클릭인가?
      if (e.Button == MouseButtons.Right) {
           // 헤더 이외의 열
          if (e.ColumnIndex >= 0 && e.RowIndex >= 0) {
               // 오른쪽 버튼 클릭된 열
               DataGridViewCell cell = dbView[e.ColumnIndex, e.RowIndex];
               cell.Selected = !cell.Selected; // 선택상태 반전
           }
      }
  }  
한가지더 알려드리자면, 두번째 파라미터 DataGridViewCellMouseEventArgs클래스는 MouseClick이벤트핸들러의 파라미터인 MouseEventArgs클래스의 파생클래스입니다. 이 클래스는 마우스의 위치나 클릭된 버튼 종류를 알려주며 클릭된 열의 행번호와 열번호를 리턴해주는 RowIndex속성과 ColumnIndex속성이 추가되어 있고 헤더용 열이나 행이 클릭된 경우 속성은 -1로 처리됩니다.
 
16. 행 삭제시 확인메세지를 보여주고 싶을 때
행을 선택하고 Del키를 누르면 행을 삭제할 수 있습니다. 이럴 때 행의 삭제시 확인 메세지박스를 보여주는 형태를 구현하고 싶은 분들이 있을 것입니다. 이를 한번 구현해보이도록 하겠습니다.
DataGridView컨트롤에서는 행이 삭제될 때 UserDeletingRow이벤트핸들러가 발생합니다. 따라서 이 타이밍에 확인 메세지박스를 보여주는 것을 좋을 것같습니다. 그리고 한가지 팁으로 여러개의 행을 선택하고 Del키를 누르면 선택되어 있는 각 행별로 UserDeletingRow이벤트핸들러가 발생합니다.
또한 이 UserDeletingRow이벤트핸들러의 두번째 파라미터는 DataGridViewRowCancelEventArgs객체의 Cancel속성을 true로 설정하여 행삭제를 취소할 수 있습니다.
 
private void dbView_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e) {
       if (MessageBox.Show("삭제하시겠습니까?",
                                 "지정한 행삭제",
                                 MessageBoxButtons.YesNo) == DialogResult.No)
       {
             e.Cancel = true; //삭제 취소
       }
 }  
 
17. 열 순서를 마음대로 바꾸고 싶을 때
가끔 고객의 요구로 인해 열을 사용자가 원하는 순서대로 배치하고 싶은 경우가 나옵니다. 이럴때 이런 기능을 모르면 대략 난감했죠 ㅜ_ㅜ; 근데 DataGridView에서는 간단하게 되네요 ^^; 보통 열 순서변경은 마우스로 열 헤더를 드래그&드롭하여 처리할 수 있습니다.
AllowUserToOrderColumns속성을 true로 하면 간단하게 끝납니다. ㅡ_ㅡ;;;
 
dbView.AllowUserToOrderColumns = true;

출처 : http://sdj.kr/g4/bbs/board.php?bo_table=i_css&wr_id=6
반응형
Posted by blueasa
, |