System.Windows.Forms.DisabledItemComboBox.LBNativeWindow.IndexFromPoint(int, int)

Here are the examples of the csharp api class System.Windows.Forms.DisabledItemComboBox.LBNativeWindow.IndexFromPoint(int, int) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2 Examples 7

1. Example

View license
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
		{
			var visItems = DropDownHeight / ItemHeight;
			switch (keyData)
			{
				case Keys.Down:
				case Keys.Right:
					SelectedIndex = GetNextEnabledItemIndex(SelectedIndex, true);
					return true;

				case Keys.Up:
				case Keys.Left:
					SelectedIndex = GetNextEnabledItemIndex(SelectedIndex, false);
					return true;

				case Keys.PageDown:
					if (SelectedIndex + visItems > Items.Count)
						SelectedIndex = GetNextEnabledItemIndex(Items.Count, false);
					else
						SelectedIndex = GetNextEnabledItemIndex(SelectedIndex + visItems, true);
					return true;

				case Keys.PageUp:
					if (SelectedIndex - visItems < 0)
						SelectedIndex = GetNextEnabledItemIndex(-1, true);
					else
						SelectedIndex = GetNextEnabledItemIndex(SelectedIndex - visItems, false);
					return true;

				case Keys.Home:
					SelectedIndex = GetNextEnabledItemIndex(-1, true);
					return true;

				case Keys.End:
					SelectedIndex = GetNextEnabledItemIndex(Items.Count, false);
					return true;

				case Keys.Enter:
					var pt = dropDownWindow.MapPointToClient(Cursor.Position);
					var idx = dropDownWindow.IndexFromPoint(pt.X, pt.Y);
					if (idx >= 0 && IsItemEnabled(idx))
						return false;
					DroppedDown = false;
					return true;

				case Keys.Escape:
					DroppedDown = false;
					return true;
			}
			return base.ProcessCmdKey(ref msg, keyData);
		}

2. Example

View license
protected override void WndProc(ref Message m)
			{
				if (m.Msg == 0x0202 || m.Msg == 0x0201 || m.Msg == 0x0203) /* WM_LBUTTONUP or WM_LBUTTONDOWN or WM_LBUTTONDBLCLK */
				{
					var idx = IndexFromPoint(NativeMethods.Util.SignedLOWORD(m.LParam), NativeMethods.Util.SignedHIWORD(m.LParam));
					if (idx >= 0 && !Parent.IsItemEnabled(idx))
						return;
				}
				base.WndProc(ref m);
			}