External/Aga.Controls/Tree/TreeViewAdv.Input.cs
author moel.mich
Sun, 27 May 2012 15:16:19 +0000
changeset 345 0c551e8818e0
permissions -rw-r--r--
Added the source code of Aga.Controls (TreeViewAdv for .Net) version 1.7.0.0.
moel@345
     1
using System;
moel@345
     2
using System.Collections.Generic;
moel@345
     3
using System.Text;
moel@345
     4
using System.Windows.Forms;
moel@345
     5
using System.Drawing;
moel@345
     6
using Aga.Controls.Tree.NodeControls;
moel@345
     7
using System.Drawing.Imaging;
moel@345
     8
using System.Threading;
moel@345
     9
moel@345
    10
namespace Aga.Controls.Tree
moel@345
    11
{
moel@345
    12
	public partial class TreeViewAdv
moel@345
    13
	{
moel@345
    14
		#region Keys
moel@345
    15
moel@345
    16
		protected override bool IsInputChar(char charCode)
moel@345
    17
		{
moel@345
    18
			return true;
moel@345
    19
		}
moel@345
    20
moel@345
    21
		protected override bool IsInputKey(Keys keyData)
moel@345
    22
		{
moel@345
    23
			if (((keyData & Keys.Up) == Keys.Up)
moel@345
    24
				|| ((keyData & Keys.Down) == Keys.Down)
moel@345
    25
				|| ((keyData & Keys.Left) == Keys.Left)
moel@345
    26
				|| ((keyData & Keys.Right) == Keys.Right))
moel@345
    27
				return true;
moel@345
    28
			else
moel@345
    29
				return base.IsInputKey(keyData);
moel@345
    30
		}
moel@345
    31
moel@345
    32
		internal void ChangeInput()
moel@345
    33
		{
moel@345
    34
			if ((ModifierKeys & Keys.Shift) == Keys.Shift)
moel@345
    35
			{
moel@345
    36
				if (!(Input is InputWithShift))
moel@345
    37
					Input = new InputWithShift(this);
moel@345
    38
			}
moel@345
    39
			else if ((ModifierKeys & Keys.Control) == Keys.Control)
moel@345
    40
			{
moel@345
    41
				if (!(Input is InputWithControl))
moel@345
    42
					Input = new InputWithControl(this);
moel@345
    43
			}
moel@345
    44
			else
moel@345
    45
			{
moel@345
    46
				if (!(Input.GetType() == typeof(NormalInputState)))
moel@345
    47
					Input = new NormalInputState(this);
moel@345
    48
			}
moel@345
    49
		}
moel@345
    50
moel@345
    51
		protected override void OnKeyDown(KeyEventArgs e)
moel@345
    52
		{
moel@345
    53
			base.OnKeyDown(e);
moel@345
    54
			if (!e.Handled)
moel@345
    55
			{
moel@345
    56
				if (e.KeyCode == Keys.ShiftKey || e.KeyCode == Keys.ControlKey)
moel@345
    57
					ChangeInput();
moel@345
    58
				Input.KeyDown(e);
moel@345
    59
				if (!e.Handled)
moel@345
    60
				{
moel@345
    61
					foreach (NodeControlInfo item in GetNodeControls(CurrentNode))
moel@345
    62
					{
moel@345
    63
						item.Control.KeyDown(e);
moel@345
    64
						if (e.Handled)
moel@345
    65
							break;
moel@345
    66
					}
moel@345
    67
				}
moel@345
    68
			}
moel@345
    69
		}
moel@345
    70
moel@345
    71
		protected override void OnKeyUp(KeyEventArgs e)
moel@345
    72
		{
moel@345
    73
			base.OnKeyUp(e);
moel@345
    74
			if (!e.Handled)
moel@345
    75
			{
moel@345
    76
				if (e.KeyCode == Keys.ShiftKey || e.KeyCode == Keys.ControlKey)
moel@345
    77
					ChangeInput();
moel@345
    78
				if (!e.Handled)
moel@345
    79
				{
moel@345
    80
					foreach (NodeControlInfo item in GetNodeControls(CurrentNode))
moel@345
    81
					{
moel@345
    82
						item.Control.KeyUp(e);
moel@345
    83
						if (e.Handled)
moel@345
    84
							return;
moel@345
    85
					}
moel@345
    86
				}
moel@345
    87
			}
moel@345
    88
		}
moel@345
    89
moel@345
    90
		protected override void OnKeyPress(KeyPressEventArgs e)
moel@345
    91
		{
moel@345
    92
			base.OnKeyPress(e);
moel@345
    93
			if (!e.Handled)
moel@345
    94
				_search.Search(e.KeyChar);
moel@345
    95
		}
moel@345
    96
moel@345
    97
		#endregion
moel@345
    98
moel@345
    99
		#region Mouse
moel@345
   100
moel@345
   101
		private TreeNodeAdvMouseEventArgs CreateMouseArgs(MouseEventArgs e)
moel@345
   102
		{
moel@345
   103
			TreeNodeAdvMouseEventArgs args = new TreeNodeAdvMouseEventArgs(e);
moel@345
   104
			args.ViewLocation = new Point(e.X + OffsetX,
moel@345
   105
				e.Y + _rowLayout.GetRowBounds(FirstVisibleRow).Y - ColumnHeaderHeight);
moel@345
   106
			args.ModifierKeys = ModifierKeys;
moel@345
   107
			args.Node = GetNodeAt(e.Location);
moel@345
   108
			NodeControlInfo info = GetNodeControlInfoAt(args.Node, e.Location);
moel@345
   109
			args.ControlBounds = info.Bounds;
moel@345
   110
			args.Control = info.Control;
moel@345
   111
			return args;
moel@345
   112
		}
moel@345
   113
moel@345
   114
		protected override void OnMouseWheel(MouseEventArgs e)
moel@345
   115
		{
moel@345
   116
			_search.EndSearch();
moel@345
   117
			if (SystemInformation.MouseWheelScrollLines > 0)
moel@345
   118
			{
moel@345
   119
				int lines = e.Delta / 120 * SystemInformation.MouseWheelScrollLines;
moel@345
   120
				int newValue = _vScrollBar.Value - lines;
moel@345
   121
				newValue = Math.Min(_vScrollBar.Maximum - _vScrollBar.LargeChange + 1, newValue);
moel@345
   122
				newValue = Math.Min(_vScrollBar.Maximum, newValue);
moel@345
   123
				_vScrollBar.Value = Math.Max(_vScrollBar.Minimum, newValue);
moel@345
   124
			}
moel@345
   125
			base.OnMouseWheel(e);
moel@345
   126
		}
moel@345
   127
moel@345
   128
		protected override void OnMouseDown(MouseEventArgs e)
moel@345
   129
		{
moel@345
   130
			if (CurrentEditorOwner != null)
moel@345
   131
			{
moel@345
   132
				CurrentEditorOwner.EndEdit(true);
moel@345
   133
				return;
moel@345
   134
			}
moel@345
   135
moel@345
   136
			if (!Focused)
moel@345
   137
				Focus();
moel@345
   138
moel@345
   139
			_search.EndSearch();
moel@345
   140
			if (e.Button == MouseButtons.Left)
moel@345
   141
			{
moel@345
   142
				TreeColumn c;
moel@345
   143
				c = GetColumnDividerAt(e.Location);
moel@345
   144
				if (c != null)
moel@345
   145
				{
moel@345
   146
					Input = new ResizeColumnState(this, c, e.Location);
moel@345
   147
					return;
moel@345
   148
				}
moel@345
   149
				c = GetColumnAt(e.Location);
moel@345
   150
				if (c != null)
moel@345
   151
				{
moel@345
   152
					Input = new ClickColumnState(this, c, e.Location);
moel@345
   153
					UpdateView();
moel@345
   154
					return;
moel@345
   155
				}
moel@345
   156
			}
moel@345
   157
moel@345
   158
			ChangeInput();
moel@345
   159
			TreeNodeAdvMouseEventArgs args = CreateMouseArgs(e);
moel@345
   160
moel@345
   161
			if (args.Node != null && args.Control != null)
moel@345
   162
				args.Control.MouseDown(args);
moel@345
   163
moel@345
   164
			if (!args.Handled)
moel@345
   165
				Input.MouseDown(args);
moel@345
   166
moel@345
   167
			base.OnMouseDown(e);
moel@345
   168
		}
moel@345
   169
moel@345
   170
		protected override void OnMouseClick(MouseEventArgs e)
moel@345
   171
		{
moel@345
   172
			//TODO: Disable when click on plusminus icon
moel@345
   173
			TreeNodeAdvMouseEventArgs args = CreateMouseArgs(e);
moel@345
   174
			if (args.Node != null)
moel@345
   175
				OnNodeMouseClick(args);
moel@345
   176
moel@345
   177
			base.OnMouseClick(e);
moel@345
   178
		}
moel@345
   179
moel@345
   180
		protected override void OnMouseDoubleClick(MouseEventArgs e)
moel@345
   181
		{
moel@345
   182
			TreeNodeAdvMouseEventArgs args = CreateMouseArgs(e);
moel@345
   183
moel@345
   184
			if (args.Node != null && args.Control != null)
moel@345
   185
				args.Control.MouseDoubleClick(args);
moel@345
   186
moel@345
   187
			if (!args.Handled)
moel@345
   188
			{
moel@345
   189
				if (args.Node != null)
moel@345
   190
					OnNodeMouseDoubleClick(args);
moel@345
   191
				else
moel@345
   192
					Input.MouseDoubleClick(args);
moel@345
   193
moel@345
   194
				if (!args.Handled)
moel@345
   195
				{
moel@345
   196
					if (args.Node != null && args.Button == MouseButtons.Left)
moel@345
   197
						args.Node.IsExpanded = !args.Node.IsExpanded;
moel@345
   198
				}
moel@345
   199
			}
moel@345
   200
moel@345
   201
			base.OnMouseDoubleClick(e);
moel@345
   202
		}
moel@345
   203
moel@345
   204
		protected override void OnMouseUp(MouseEventArgs e)
moel@345
   205
		{
moel@345
   206
			TreeNodeAdvMouseEventArgs args = CreateMouseArgs(e);
moel@345
   207
			if (Input is ResizeColumnState)
moel@345
   208
				Input.MouseUp(args);
moel@345
   209
			else
moel@345
   210
			{
moel@345
   211
				if (args.Node != null && args.Control != null)
moel@345
   212
					args.Control.MouseUp(args);
moel@345
   213
				if (!args.Handled)
moel@345
   214
					Input.MouseUp(args);
moel@345
   215
moel@345
   216
				base.OnMouseUp(e);
moel@345
   217
			}
moel@345
   218
		}
moel@345
   219
moel@345
   220
		protected override void OnMouseMove(MouseEventArgs e)
moel@345
   221
		{
moel@345
   222
			if (Input.MouseMove(e))
moel@345
   223
				return;
moel@345
   224
moel@345
   225
			base.OnMouseMove(e);
moel@345
   226
			SetCursor(e);
moel@345
   227
			UpdateToolTip(e);
moel@345
   228
			if (ItemDragMode && Dist(e.Location, ItemDragStart) > ItemDragSensivity
moel@345
   229
				&& CurrentNode != null && CurrentNode.IsSelected)
moel@345
   230
			{
moel@345
   231
				ItemDragMode = false;
moel@345
   232
				_toolTip.Active = false;
moel@345
   233
				OnItemDrag(e.Button, Selection.ToArray());
moel@345
   234
			}
moel@345
   235
		}
moel@345
   236
moel@345
   237
		protected override void OnMouseLeave(EventArgs e)
moel@345
   238
		{
moel@345
   239
			_hotColumn = null;
moel@345
   240
			UpdateHeaders();
moel@345
   241
			base.OnMouseLeave(e);
moel@345
   242
		}
moel@345
   243
moel@345
   244
		private void SetCursor(MouseEventArgs e)
moel@345
   245
		{
moel@345
   246
			TreeColumn col;
moel@345
   247
			col = GetColumnDividerAt(e.Location);
moel@345
   248
			if (col == null)
moel@345
   249
				_innerCursor = null;
moel@345
   250
			else
moel@345
   251
			{
moel@345
   252
				if (col.Width == 0)
moel@345
   253
					_innerCursor = ResourceHelper.DVSplitCursor;
moel@345
   254
				else
moel@345
   255
					_innerCursor = Cursors.VSplit;
moel@345
   256
			}
moel@345
   257
moel@345
   258
			col = GetColumnAt(e.Location);
moel@345
   259
			if (col != _hotColumn)
moel@345
   260
			{
moel@345
   261
				_hotColumn = col;
moel@345
   262
				UpdateHeaders();
moel@345
   263
			}
moel@345
   264
		}
moel@345
   265
moel@345
   266
		internal TreeColumn GetColumnAt(Point p)
moel@345
   267
		{
moel@345
   268
			if (p.Y > ColumnHeaderHeight)
moel@345
   269
				return null;
moel@345
   270
moel@345
   271
			int x = -OffsetX;
moel@345
   272
			foreach (TreeColumn col in Columns)
moel@345
   273
			{
moel@345
   274
				if (col.IsVisible)
moel@345
   275
				{
moel@345
   276
					Rectangle rect = new Rectangle(x, 0, col.Width, ColumnHeaderHeight);
moel@345
   277
					x += col.Width;
moel@345
   278
					if (rect.Contains(p))
moel@345
   279
						return col;
moel@345
   280
				}
moel@345
   281
			}
moel@345
   282
			return null;
moel@345
   283
		}
moel@345
   284
moel@345
   285
		internal int GetColumnX(TreeColumn column)
moel@345
   286
		{
moel@345
   287
			int x = -OffsetX;
moel@345
   288
			foreach (TreeColumn col in Columns)
moel@345
   289
			{
moel@345
   290
				if (col.IsVisible)
moel@345
   291
				{
moel@345
   292
					if (column == col)
moel@345
   293
						return x;
moel@345
   294
					else
moel@345
   295
						x += col.Width;
moel@345
   296
				}
moel@345
   297
			}
moel@345
   298
			return x;
moel@345
   299
		}
moel@345
   300
moel@345
   301
		internal TreeColumn GetColumnDividerAt(Point p)
moel@345
   302
		{
moel@345
   303
			if (p.Y > ColumnHeaderHeight)
moel@345
   304
				return null;
moel@345
   305
moel@345
   306
			int x = -OffsetX;
moel@345
   307
			TreeColumn prevCol = null;
moel@345
   308
			Rectangle left, right;
moel@345
   309
			foreach (TreeColumn col in Columns)
moel@345
   310
			{
moel@345
   311
				if (col.IsVisible)
moel@345
   312
				{
moel@345
   313
					if (col.Width > 0)
moel@345
   314
					{
moel@345
   315
						left = new Rectangle(x, 0, DividerWidth / 2, ColumnHeaderHeight);
moel@345
   316
						right = new Rectangle(x + col.Width - (DividerWidth / 2), 0, DividerWidth / 2, ColumnHeaderHeight);
moel@345
   317
						if (left.Contains(p) && prevCol != null)
moel@345
   318
							return prevCol;
moel@345
   319
						else if (right.Contains(p))
moel@345
   320
							return col;
moel@345
   321
					}
moel@345
   322
					prevCol = col;
moel@345
   323
					x += col.Width;
moel@345
   324
				}
moel@345
   325
			}
moel@345
   326
moel@345
   327
			left = new Rectangle(x, 0, DividerWidth / 2, ColumnHeaderHeight);
moel@345
   328
			if (left.Contains(p) && prevCol != null)
moel@345
   329
				return prevCol;
moel@345
   330
moel@345
   331
			return null;
moel@345
   332
		}
moel@345
   333
moel@345
   334
		TreeColumn _tooltipColumn;
moel@345
   335
		private void UpdateToolTip(MouseEventArgs e)
moel@345
   336
		{
moel@345
   337
			TreeColumn col = GetColumnAt(e.Location);
moel@345
   338
			if (col != null)
moel@345
   339
			{
moel@345
   340
				if (col != _tooltipColumn)
moel@345
   341
					SetTooltip(col.TooltipText);
moel@345
   342
			}
moel@345
   343
			else
moel@345
   344
				DisplayNodesTooltip(e);
moel@345
   345
			_tooltipColumn = col;
moel@345
   346
		}
moel@345
   347
moel@345
   348
		TreeNodeAdv _hotNode;
moel@345
   349
		NodeControl _hotControl;
moel@345
   350
		private void DisplayNodesTooltip(MouseEventArgs e)
moel@345
   351
		{
moel@345
   352
			if (ShowNodeToolTips)
moel@345
   353
			{
moel@345
   354
				TreeNodeAdvMouseEventArgs args = CreateMouseArgs(e);
moel@345
   355
				if (args.Node != null && args.Control != null)
moel@345
   356
				{
moel@345
   357
					if (args.Node != _hotNode || args.Control != _hotControl)
moel@345
   358
						SetTooltip(GetNodeToolTip(args));
moel@345
   359
				}
moel@345
   360
				else
moel@345
   361
					_toolTip.SetToolTip(this, null);
moel@345
   362
moel@345
   363
				_hotControl = args.Control;
moel@345
   364
				_hotNode = args.Node;
moel@345
   365
			}
moel@345
   366
			else
moel@345
   367
				_toolTip.SetToolTip(this, null);
moel@345
   368
		}
moel@345
   369
moel@345
   370
		private void SetTooltip(string text)
moel@345
   371
		{
moel@345
   372
			if (!String.IsNullOrEmpty(text))
moel@345
   373
			{
moel@345
   374
				_toolTip.Active = false;
moel@345
   375
				_toolTip.SetToolTip(this, text);
moel@345
   376
				_toolTip.Active = true;
moel@345
   377
			}
moel@345
   378
			else
moel@345
   379
				_toolTip.SetToolTip(this, null);
moel@345
   380
		}
moel@345
   381
moel@345
   382
		private string GetNodeToolTip(TreeNodeAdvMouseEventArgs args)
moel@345
   383
		{
moel@345
   384
			string msg = args.Control.GetToolTip(args.Node);
moel@345
   385
moel@345
   386
			BaseTextControl btc = args.Control as BaseTextControl;
moel@345
   387
			if (btc != null && btc.DisplayHiddenContentInToolTip && String.IsNullOrEmpty(msg))
moel@345
   388
			{
moel@345
   389
				Size ms = btc.GetActualSize(args.Node, _measureContext);
moel@345
   390
				if (ms.Width > args.ControlBounds.Size.Width || ms.Height > args.ControlBounds.Size.Height
moel@345
   391
					|| args.ControlBounds.Right - OffsetX > DisplayRectangle.Width)
moel@345
   392
					msg = btc.GetLabel(args.Node);
moel@345
   393
			}
moel@345
   394
moel@345
   395
			if (String.IsNullOrEmpty(msg) && DefaultToolTipProvider != null)
moel@345
   396
				msg = DefaultToolTipProvider.GetToolTip(args.Node, args.Control);
moel@345
   397
moel@345
   398
			return msg;
moel@345
   399
		}
moel@345
   400
moel@345
   401
		#endregion
moel@345
   402
moel@345
   403
		#region DragDrop
moel@345
   404
moel@345
   405
		private bool _dragAutoScrollFlag = false;
moel@345
   406
		private Bitmap _dragBitmap = null;
moel@345
   407
		private System.Threading.Timer _dragTimer;
moel@345
   408
moel@345
   409
		private void StartDragTimer()
moel@345
   410
		{
moel@345
   411
			if (_dragTimer == null)
moel@345
   412
				_dragTimer = new System.Threading.Timer(new TimerCallback(DragTimerTick), null, 0, 100);
moel@345
   413
		}
moel@345
   414
moel@345
   415
		private void StopDragTimer()
moel@345
   416
		{
moel@345
   417
			if (_dragTimer != null)
moel@345
   418
			{
moel@345
   419
				_dragTimer.Dispose();
moel@345
   420
				_dragTimer = null;
moel@345
   421
			}
moel@345
   422
		}
moel@345
   423
moel@345
   424
		private void SetDropPosition(Point pt)
moel@345
   425
		{
moel@345
   426
			TreeNodeAdv node = GetNodeAt(pt);
moel@345
   427
			OnDropNodeValidating(pt, ref node);
moel@345
   428
			_dropPosition.Node = node;
moel@345
   429
			if (node != null)
moel@345
   430
			{
moel@345
   431
				Rectangle first = _rowLayout.GetRowBounds(FirstVisibleRow);
moel@345
   432
				Rectangle bounds = _rowLayout.GetRowBounds(node.Row);
moel@345
   433
				float pos = (pt.Y + first.Y - ColumnHeaderHeight - bounds.Y) / (float)bounds.Height;
moel@345
   434
				if (pos < TopEdgeSensivity)
moel@345
   435
					_dropPosition.Position = NodePosition.Before;
moel@345
   436
				else if (pos > (1 - BottomEdgeSensivity))
moel@345
   437
					_dropPosition.Position = NodePosition.After;
moel@345
   438
				else
moel@345
   439
					_dropPosition.Position = NodePosition.Inside;
moel@345
   440
			}
moel@345
   441
		}
moel@345
   442
moel@345
   443
		private void DragTimerTick(object state)
moel@345
   444
		{
moel@345
   445
			_dragAutoScrollFlag = true;
moel@345
   446
		}
moel@345
   447
moel@345
   448
		private void DragAutoScroll()
moel@345
   449
		{
moel@345
   450
			_dragAutoScrollFlag = false;
moel@345
   451
			Point pt = PointToClient(MousePosition);
moel@345
   452
			if (pt.Y < 20 && _vScrollBar.Value > 0)
moel@345
   453
				_vScrollBar.Value--;
moel@345
   454
			else if (pt.Y > Height - 20 && _vScrollBar.Value <= _vScrollBar.Maximum - _vScrollBar.LargeChange)
moel@345
   455
				_vScrollBar.Value++;
moel@345
   456
		}
moel@345
   457
moel@345
   458
		public void DoDragDropSelectedNodes(DragDropEffects allowedEffects)
moel@345
   459
		{
moel@345
   460
			if (SelectedNodes.Count > 0)
moel@345
   461
			{
moel@345
   462
				TreeNodeAdv[] nodes = new TreeNodeAdv[SelectedNodes.Count];
moel@345
   463
				SelectedNodes.CopyTo(nodes, 0);
moel@345
   464
				DoDragDrop(nodes, allowedEffects);
moel@345
   465
			}
moel@345
   466
		}
moel@345
   467
moel@345
   468
		private void CreateDragBitmap(IDataObject data)
moel@345
   469
		{
moel@345
   470
			if (UseColumns || !DisplayDraggingNodes)
moel@345
   471
				return;
moel@345
   472
moel@345
   473
			TreeNodeAdv[] nodes = data.GetData(typeof(TreeNodeAdv[])) as TreeNodeAdv[];
moel@345
   474
			if (nodes != null && nodes.Length > 0)
moel@345
   475
			{
moel@345
   476
				Rectangle rect = DisplayRectangle;
moel@345
   477
				Bitmap bitmap = new Bitmap(rect.Width, rect.Height);
moel@345
   478
				using (Graphics gr = Graphics.FromImage(bitmap))
moel@345
   479
				{
moel@345
   480
					gr.Clear(BackColor);
moel@345
   481
					DrawContext context = new DrawContext();
moel@345
   482
					context.Graphics = gr;
moel@345
   483
					context.Font = Font;
moel@345
   484
					context.Enabled = true;
moel@345
   485
					int y = 0;
moel@345
   486
					int maxWidth = 0;
moel@345
   487
					foreach (TreeNodeAdv node in nodes)
moel@345
   488
					{
moel@345
   489
						if (node.Tree == this)
moel@345
   490
						{
moel@345
   491
							int x = 0;
moel@345
   492
							int height = _rowLayout.GetRowBounds(node.Row).Height;
moel@345
   493
							foreach (NodeControl c in NodeControls)
moel@345
   494
							{
moel@345
   495
								Size s = c.GetActualSize(node, context);
moel@345
   496
								if (!s.IsEmpty)
moel@345
   497
								{
moel@345
   498
									int width = s.Width;
moel@345
   499
									rect = new Rectangle(x, y, width, height);
moel@345
   500
									x += (width + 1);
moel@345
   501
									context.Bounds = rect;
moel@345
   502
									c.Draw(node, context);
moel@345
   503
								}
moel@345
   504
							}
moel@345
   505
							y += height;
moel@345
   506
							maxWidth = Math.Max(maxWidth, x);
moel@345
   507
						}
moel@345
   508
					}
moel@345
   509
moel@345
   510
					if (maxWidth > 0 && y > 0)
moel@345
   511
					{
moel@345
   512
						_dragBitmap = new Bitmap(maxWidth, y, PixelFormat.Format32bppArgb);
moel@345
   513
						using (Graphics tgr = Graphics.FromImage(_dragBitmap))
moel@345
   514
							tgr.DrawImage(bitmap, Point.Empty);
moel@345
   515
						BitmapHelper.SetAlphaChanelValue(_dragBitmap, 150);
moel@345
   516
					}
moel@345
   517
					else
moel@345
   518
						_dragBitmap = null;
moel@345
   519
				}
moel@345
   520
			}
moel@345
   521
		}
moel@345
   522
moel@345
   523
		protected override void OnDragOver(DragEventArgs drgevent)
moel@345
   524
		{
moel@345
   525
			ItemDragMode = false;
moel@345
   526
			Point pt = PointToClient(new Point(drgevent.X, drgevent.Y));
moel@345
   527
			if (_dragAutoScrollFlag)
moel@345
   528
				DragAutoScroll();
moel@345
   529
			SetDropPosition(pt);
moel@345
   530
			UpdateView();
moel@345
   531
			base.OnDragOver(drgevent);
moel@345
   532
		}
moel@345
   533
moel@345
   534
		protected override void OnDragEnter(DragEventArgs drgevent)
moel@345
   535
		{
moel@345
   536
			_search.EndSearch();
moel@345
   537
			DragMode = true;
moel@345
   538
			CreateDragBitmap(drgevent.Data);
moel@345
   539
			base.OnDragEnter(drgevent);
moel@345
   540
		}
moel@345
   541
moel@345
   542
		protected override void OnDragLeave(EventArgs e)
moel@345
   543
		{
moel@345
   544
			DragMode = false;
moel@345
   545
			UpdateView();
moel@345
   546
			base.OnDragLeave(e);
moel@345
   547
		}
moel@345
   548
moel@345
   549
		protected override void OnDragDrop(DragEventArgs drgevent)
moel@345
   550
		{
moel@345
   551
			DragMode = false;
moel@345
   552
			UpdateView();
moel@345
   553
			base.OnDragDrop(drgevent);
moel@345
   554
		}
moel@345
   555
moel@345
   556
		#endregion
moel@345
   557
	}
moel@345
   558
}