System.Drawing.Rectangle.Contains(System.Drawing.Point)

Here are the examples of the csharp api class System.Drawing.Rectangle.Contains(System.Drawing.Point) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

200 Examples 7

1. Example

Project: Krypton
Source File: KryptonSplitContainerGlyph.cs
public override Cursor GetHitTest(Point pt)
        {
            if (_splitContainer != null)
            {
                Rectangle bounds = Bounds;

                // Is the point inside the bounds of the split container?
                if (bounds.Contains(pt))
                {
                    // Convert from adorner coordinates to the control client coordinates
                    Point splitPt = new Point(pt.X - bounds.X, pt.Y - bounds.Y);

                    // Ask the split container for the correct cursor to use
                    return _splitContainer.DesignGetHitTest(splitPt);
                }
            }

            return null;
        }

2. Example

Project: Krypton
Source File: DragTarget.cs
public virtual bool IsMatch(Point screenPt, PageDragEndData dragEndData)
        {
            // Default to matching if the mouse is inside the targets hot area
            return HotRect.Contains(screenPt);
        }

3. Example

Project: Krypton
Source File: GroupButtonController.cs
private bool ClickOnDown(Point pt)
        {
            switch (_buttonType)
            {
                case GroupButtonType.Push:
                case GroupButtonType.Check:
                default:
                    return false;
                case GroupButtonType.DropDown:
                    return true;
                case GroupButtonType.Split:
                    return _splitRectangle.Contains(pt);
            }
        }

4. Example

Project: Krypton
Source File: VisualPopupAppMenu.cs
public override bool DoesMouseDownGetEaten(Message m, Point pt)
        {
            // Is the point inside the area of the application button
            if (_rectAppButtonTopHalf.Contains(pt))
            {
                VisualPopupManager.Singleton.EndAllTracking();
                return true;
            }
            else
                return base.DoesMouseDownGetEaten(m, pt);
        }

5. Example

Project: Krypton
Source File: KryptonDomainUpDown.cs
private PaletteState ButtonElementState(Rectangle buttonRect)
            {
                if (DomainUpDown.Enabled)
                {
                    if (MouseOver && buttonRect.Contains(MousePoint))
                    {
                        if (buttonRect.Contains(_mousePressed))
                            return PaletteState.Pressed;
                        else if (_mousePressed.X == -int.MaxValue)
                            return PaletteState.Tracking;
                    }

                    if (DomainUpDown.IsActive || (DomainUpDown.IsFixedActive && (DomainUpDown.InputControlStyle == InputControlStyle.Standalone)))
                    {
                        if (DomainUpDown.InputControlStyle == InputControlStyle.Standalone)
                            return PaletteState.CheckedNormal;
                        else
                            return PaletteState.CheckedTracking;
                    }
                    else
                        return PaletteState.Normal;
                }
                else
                    return PaletteState.Disabled;
            }

6. Example

Project: Krypton
Source File: KryptonForm.cs
protected override IntPtr WindowChromeHitTest(Point pt, bool composition)
        {
            Poin/n ..... /n //View Source file for more details /n }

7. Example

Project: Krypton
Source File: KryptonNumericUpDown.cs
private PaletteState ButtonElementState(Rectangle buttonRect)
            {
                if (NumericUpDown.Enabled)
                {
                    if (MouseOver && buttonRect.Contains(MousePoint))
                    {
                        if (buttonRect.Contains(_mousePressed))
                            return PaletteState.Pressed;
                        else if (_mousePressed.X == -int.MaxValue)
                            return PaletteState.Tracking;
                    }

                    if (NumericUpDown.IsActive || (NumericUpDown.IsFixedActive && (NumericUpDown.InputControlStyle == InputControlStyle.Standalone)))
                    {
                        if (NumericUpDown.InputControlStyle == InputControlStyle.Standalone)
                            return PaletteState.CheckedNormal;
                        else
                            return PaletteState.CheckedTracking;
                    }
                    else
                        return PaletteState.Normal;
                }
                else
                    return PaletteState.Disabled;
            }

8. Example

Project: Krypton
Source File: VisualContextMenuDTP.cs
public override bool DoesMouseDownGetEaten(Message m, Point pt)
        {
            // If the user dismissed the context menu by clicking down on the drop down button of
            // the KryptonDateTimePicker then eat the down message to prevent the down press from
            // opening the menu again.
            return _dropScreenRect.Contains(new Point(pt.X, pt.Y));
        }

9. Example

Project: Krypton
Source File: VisualPopup.cs
public virtual bool DoesStackedClientMouseDownBecomeCurrent(Message m, Point pt)
        {
            return ClientRectangle.Contains(pt);
        }

10. Example

Project: Cyotek.Windows.Forms.ImageBox
Source File: ImageBoxEx.cs
private bool IsOutsideDragZone(Point location)
    {
      Rectangle dragZone;
      int dragWidth;
      int dragHeight;

      dragWidth = SystemInformation.DragSize.Width;
      dragHeight = SystemInformation.DragSize.Height;
      dragZone = new Rectangle(this.DragOrigin.X - (dragWidth / 2), this.DragOrigin.Y - (dragHeight / 2), dragWidth, dragHeight);

      return !dragZone.Contains(location);
    }

11. Example

Project: ImageGlass
Source File: Helper.cs
public static bool IsOnScreen(Point location)
        {
            Screen[] screens = Screen.AllScreens;
            foreach (Screen screen in screens)
            {
                if (screen.WorkingArea.Contains(location))
                {
                    return true;
                }
            }

            return false;
        }

12. Example

Project: VisualPlus
Source File: GraphicsManager.cs
public static bool IsMouseInBounds(Point mousePoint, Rectangle bounds)
        {
            return bounds.Contains(mousePoint);
        }

13. Example

Project: Depressurizer
Source File: Utility.cs
public static bool IsOnScreen(MaterialForm form)
        {
            Screen[] screens = Screen.AllScreens;
            foreach (Screen screen in screens)
            {
                Point formTopLeft = new Point(form.Left, form.Top);

                if (screen.WorkingArea.Contains(formTopLeft))
                {
                    return true;
                }
            }

            return false;
        }

14. Example

Project: DroppedBoxx
Source File: ControlContainer.cs
public virtual FluidControl ControlFromPoint(int x, int y)
        {
            p.X = x;
            p.Y = y;
            for (int i = controls.Count - 1; i >= 0; i--)
            {
                FluidControl c = controls[i];
                if (!c.Visible) continue;
                Rectangle r = c.Bounds;
                if (r.Contains(p)) return c;
            }
            return null;
        }

15. Example

Project: DroppedBoxx
Source File: ScrollPanel.cs
public FluidControl ControlFromPoint(int x, int y)
        {
            Point p = checkPoint; 
            p.X = x;
            p.Y = y + TopOffset;
            for (int i = controls.Count - 1; i >= 0; i--)
            {
                FluidControl c = controls[i];
                if (!c.Visible) continue;
                Rectangle r = c.Bounds;
                if (r.Contains(p)) return c;
            }
            return null;
        }

16. Example

Project: fomm
Source File: dxmutgui.cs
public virtual bool ContainsPoint(System.Drawing.Point pt) { return boundingBox.Contains(pt); }

17. Example

Project: fomm
Source File: dxmutgui.cs
public override bool ContainsPoint(System.Drawing.Point pt)
        {
            return (boundingBox.Contains(pt) || buttonRect.Contains(pt));
        }

18. Example

Project: fomm
Source File: dxmutgui.cs
public override bool ContainsPoint(System.Drawing.Point pt)
        {
            return boundingBox.Contains(pt) || buttonRect.Contains(pt);
        }

19. Example

Project: XboxKeyboardMouse
Source File: MaterialCheckbox.cs
private bool IsMouseInCheckArea()
        {
            return _boxRectangle.Contains(MouseLocation);
        }

20. Example

Project: XboxKeyboardMouse
Source File: MaterialRadioButton.cs
private bool IsMouseInCheckArea()
        {
            return _radioButtonBounds.Contains(MouseLocation);
        }

21. Example

Project: MaterialWinforms
Source File: MaterialTabSelector.cs
void OpenInNewWindow_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < tabRects.Count; i++)
            {
                if (tabRects[i].TabRect.Contains(RightClickLocation))
                {
                    var me = this;
                    TabWindow t = new TabWindow((MaterialTabPage)baseTabControl.TabPages[i], ref me);
                    t.Show();
                    return;
                }
            }
        }

22. Example

Project: MaterialWinforms
Source File: MaterialCheckbox.cs
private bool IsMouseInCheckArea()
        {
            return boxRectangle.Contains(MouseLocation);
        }

23. Example

Project: MaterialWinforms
Source File: MaterialRadioButton.cs
private bool IsMouseInCheckArea()
        {
            return radioButtonBounds.Contains(MouseLocation);
        }

24. Example

Project: MaterialWinforms
Source File: MaterialScrollBar.cs
public bool HitTest(Point point)
        {
            return thumbRectangle.Contains(point);
        }

25. Example

Project: MaterialSkin
Source File: MaterialCheckbox.cs
private bool IsMouseInCheckArea()
        {
            return _boxRectangle.Contains(MouseLocation);
        }

26. Example

Project: MaterialSkin
Source File: MaterialRadioButton.cs
private bool IsMouseInCheckArea()
        {
            return _radioButtonBounds.Contains(MouseLocation);
        }

27. Example

Project: SimpleScene
Source File: SHudTargetsManager.cs
public bool mouseHitTest(Point pt)
            {
                return _outlineScreenRect.Contains(pt);
            }

28. Example

Project: lua-tilde
Source File: SearchHelper.cs
public void MoveFormAwayFromSelection(Form form)
        {
            if (criteria.MoveFormAwayFromSelection && (form != null))
            {
                int pos = editControl.CurrentPos;
                int x = editControl.PointXFromPosition(pos);
                int y = editControl.PointYFromPosition(pos);

                Point cursorPoint = editControl.PointToScreen(new Point(x, y));

                Point formLocation = form.Location;
                Rectangle r = new Rectangle(formLocation, form.Size);
                if (r.Contains(cursorPoint))
                {
                    Point newLocation;
                    if (cursorPoint.Y < (Screen.PrimaryScreen.Bounds.Height / 2))
                    {
                        // Top half of the screen
                        newLocation = editControl.PointToClient(
                            new Point(formLocation.X, cursorPoint.Y + editControl.Font.Height)
                            );
                    }
                    else
                    {
                        // Bottom half of the screen
                        newLocation = editControl.PointToClient(
                            new Point(formLocation.X, cursorPoint.Y - form.Height)
                            );
                    }
                    newLocation = editControl.PointToScreen(newLocation);
                    form.Location = newLocation;
                }
            }
        }

29. Example

Project: WzComparerR2
Source File: AControl.cs
protected virtual bool IsMouseContains(Point mouseLocation)
        {
            return this.visible && this.Rectangle.Contains(mouseLocation);
        }

30. Example

Project: WzComparerR2
Source File: AfrmItem.cs
private void tab_OnMouseClick(MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                for (int i = 0; i < this.itemTabs.Length; i++)
                {
                    Rectangle rect;
                    if (this.itemTabs[i].Selected)
                    {
                        rect = this.itemTabs[i].TabEnabled.Rectangle;
                    }
                    else
                    {
                        rect = this.itemTabs[i].TabDisabled.Rectangle;
                    }
                    if (rect.Contains(e.Location))
                    {
                        if (this.SelectedIndex != i)
                        {
                            this.SelectedIndex = i;
                            this.btnGather.Visible = true; //??tab???btnGather??
                            this.waitForRefresh = true;
                        }
                        break;
                    }
                }
            }
        }

31. Example

Project: WzComparerR2
Source File: AlphaForm.cs
protected virtual bool captionHitTest(Point point)
        {
            return this.captionRectangle.Contains(point);
        }

32. Example

Project: BaijiGenerator.Net
Source File: FastColoredTextBox.cs
private VisualMarker FindVisualMarkerForPoint(Point p)
        {
            foreach (VisualMarker m in visibleMarkers)
                if (m.rectangle.Contains(p))
                    return m;
            return null;
        }

33. Example

Project: OpenLiveWriter
Source File: HiddenMenuFrameManager.cs
private bool IsMouseInFrame()
        {
            RECT rect = new RECT();
            User32.GetWindowRect(_form.Handle, ref rect);
            Rectangle windowRect = RectangleHelper.Convert(rect);
            return
                windowRect.Contains(Control.MousePosition) &&
                !_form.ClientRectangle.Contains(_form.PointToClient(Control.MousePosition));
        }

34. Example

Project: OpenLiveWriter
Source File: SizeBorderHitTester.cs
public int Test(Size formSize, Point test)
        {
            int width = formSize.Width;
       /n ..... /n //View Source file for more details /n }

35. Example

Project: OpenLiveWriter
Source File: ResizerControl.cs
public SizerHandle GetHandleForPoint(Point p)
        {
            if (tlCorner.Contains(p))
                return SizerHandle.TopLeft;
            else if (trCorner.Contains(p))
                return SizerHandle.TopRight;
            else if (blCorner.Contains(p))
                return SizerHandle.BottomLeft;
            else if (brCorner.Contains(p))
                return SizerHandle.BottomRight;
            else if (topSide.Contains(p))
                return SizerHandle.Top;
            else if (rightSide.Contains(p))
                return SizerHandle.Right;
            else if (bottomSide.Contains(p))
                return SizerHandle.Bottom;
            else if (leftSide.Contains(p))
                return SizerHandle.Left;
            else
                return SizerHandle.None;
        }

36. Example

Project: OpenLiveWriter
Source File: WindowCascadeHelper.cs
private static Point FixUpLocation(Screen ourScreen, Point location, Size recSize)
        {
            Point topRight = new Point(location.X + recSize.Width, location.Y);
            Point lowerLeft = new Point(location.X, location.Y + recSize.Height);
            int newLeft = location.X;
            int newTop = location.Y;
            if (!ourScreen.WorkingArea.Contains(topRight))
            {
                newLeft = ourScreen.WorkingArea.X;
            }
            if (!ourScreen.WorkingArea.Contains(lowerLeft))
            {
                newTop = ourScreen.WorkingArea.Y;
            }
            return new Point(newLeft, newTop);
        }

37. Example

Project: winforms-modernui
Source File: MetroScrollBar.cs
public bool HitTest(Point point)
        {
            return thumbRectangle.Contains(point);
        }

38. Example

Project: SystemEx
Source File: Form.cs
private static Screen FindScreen(Point location)
        {
            foreach (var screen in Screen.AllScreens)
            {
                if (screen.WorkingArea.Contains(location))
                {
                    return screen;
                }
            }

            return null;
        }

39. Example

Project: Repetier-Host
Source File: RegMemory.cs
private static bool IsVisibleOnAnyScreen(Point pnt)
        {
            foreach (Screen screen in Screen.AllScreens)
            {
                if (screen.WorkingArea.Contains(pnt))
                {
                    return true;
                }
            }
            return false;
        }

40. Example

Project: WYZTracker
Source File: frmDockedMain.cs
private void lboxPatterns_MouseDown(object sender, MouseEventArgs e)
        {
            if (this.songPlayer.Status == PlayStatus.Playing)
            {
                for (int patIdx = 0; patIdx < lboxPatterns.Items.Count; patIdx++)
                {
                    Rectangle rect = this.lboxPatterns.GetItemRectangle(patIdx);
                    if (rect.Contains(e.Location))
                    {
                        this.songPlayer.GoToPattern(patIdx);
                        break;
                    }
                }
            }
        }

41. Example

Project: DarkUI
Source File: DarkToolWindow.cs
protected override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);

            if (_closeButtonRect.Contains(e.Location) || _closeButtonPressed)
            {
                if (!_closeButtonHot)
                {
                    _closeButtonHot = true;
                    Invalidate();
                }
            }
            else
            {
                if (_closeButtonHot)
                {
                    _closeButtonHot = false;
                    Invalidate();
                }

                if (_shouldDrag)
                {
                    DockPanel.DragContent(this);
                    return;
                }
            }
        }

42. Example

Project: DarkUI
Source File: DarkToolWindow.cs
protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);

            if (_closeButtonRect.Contains(e.Location))
            {
                _closeButtonPressed = true;
                _closeButtonHot = true;
                Invalidate();
                return;
            }

            if (_headerRect.Contains(e.Location))
            {
                _shouldDrag = true;
                return;
            }
        }

43. Example

Project: DarkUI
Source File: DarkToolWindow.cs
protected override void OnMouseUp(MouseEventArgs e)
        {
            base.OnMouseUp(e);

            if (_closeButtonRect.Contains(e.Location) && _closeButtonPressed)
                Close();

            _closeButtonPressed = false;
            _closeButtonHot = false;

            _shouldDrag = false;

            Invalidate();
        }

44. Example

Project: Ego-Engine-Modding
Source File: RowEdit.cs
private void tabControl_MouseDoubleClick(object sender, MouseEventArgs e) {
			if (tabControl.SelectedIndex <= 0) {
				return;
			}
			Rectangle r = tabControl.GetTabRect(tabControl.SelectedIndex);
			if (r.Contains(e.Location) == true) {
				tabControl.TabPages.RemoveAt(tabControl.SelectedIndex);
			}
		}

45. Example

Project: CityTrafficSimulator
Source File: MainForm.cs
private void thumbGrid_MouseMove(object sender, MouseEventArgs e)
			{
			// Mauszeiger ändern, falls über TimelineBar
			if (thumbGridClientRect.Contains(e.Location))
				{
				this.Cursor = Cursors.SizeAll;
				}
			else
				{
				this.Cursor = Cursors.Default;
				}

			if (howToDrag == DragNDrop.MOVE_THUMB_RECT)
				{
				thumbGridClientRect.X = e.Location.X + mouseDownPosition.X;
				thumbGridClientRect.Y = e.Location.Y + mouseDownPosition.Y;
				thumbGrid.Invalidate();
				}
			}

46. Example

Project: Florence
Source File: PlotSelection.cs
public override bool DoMouseUp(int X, int Y, Modifier keys, InteractivePlotSurface2D ps)
        {
 /n ..... /n //View Source file for more details /n }

47. Example

Project: ShareX
Source File: WindowsHelper.cs
public bool Contains(Point p)
        {
            return WindowRectangle.Contains(Cursor.Position);
        }

48. Example

Project: ShareX
Source File: DrawableContainer.cs
protected virtual void TargetGripperMove(int newX, int newY)
        {
            Point newGripperLocation = new Point(newX, newY);
            Rectangle surfaceBounds = new Rectangle(0, 0, _parent.Width, _parent.Height);
            // Check if gripper inside the parent (surface), if not we need to move it inside
            // This was made for BUG-1682
            if (!surfaceBounds.Contains(newGripperLocation))
            {
                if (newGripperLocation.X > surfaceBounds.Right)
                {
                    newGripperLocation.X = surfaceBounds.Right - 5;
                }
                if (newGripperLocation.X < surfaceBounds.Left)
                {
                    newGripperLocation.X = surfaceBounds.Left;
                }
                if (newGripperLocation.Y > surfaceBounds.Bottom)
                {
                    newGripperLocation.Y = surfaceBounds.Bottom - 5;
                }
                if (newGripperLocation.Y < surfaceBounds.Top)
                {
                    newGripperLocation.Y = surfaceBounds.Top;
                }
            }

            _targetGripper.Left = newGripperLocation.X;
            _targetGripper.Top = newGripperLocation.Y;
        }

49. Example

Project: ShareX
Source File: BaseShape.cs
public virtual bool Intersects(Point position)
        {
            return Rectangle.Contains(position);
        }

50. Example

Project: BiliRanking
Source File: MaterialCheckbox.cs
private bool IsMouseInCheckArea()
        {
            return boxRectangle.Contains(MouseLocation);
        }