• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ResizeDirection类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ResizeDirection的典型用法代码示例。如果您正苦于以下问题:C# ResizeDirection类的具体用法?C# ResizeDirection怎么用?C# ResizeDirection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ResizeDirection类属于命名空间,在下文中一共展示了ResizeDirection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ResizeDirectionToCursor

        public static Cursor ResizeDirectionToCursor(ResizeDirection direction)
        {
            Cursor result;

            switch (direction)
            {
                case ResizeDirection.None:
                    result = Cursors.Arrow;
                    break;
                case ResizeDirection.HorizontalLeft:
                case ResizeDirection.HorizontalRight:
                    result = Cursors.SizeWE;
                    break;
                case ResizeDirection.VerticalTop:
                case ResizeDirection.VerticalBottom:
                    result = Cursors.SizeNS;
                    break;
                case ResizeDirection.AscendingTopRight:
                case ResizeDirection.AscendingBottomLeft:
                    result = Cursors.SizeNESW;
                    break;
                case ResizeDirection.DescendingTopLeft:
                case ResizeDirection.DescendingBottomRight:
                    result = Cursors.SizeNWSE;
                    break;
                default:
                    result = Cursors.SizeAll;
                    break;
            }

            return result;
        }
开发者ID:GilbertTeam,项目名称:Tales-Generator,代码行数:32,代码来源:Utils.cs


示例2: Resize

        protected override void Resize(ResizeDirection direction, Vector vector)
        {
            ElementBaseShape element = DesignerItem.Element as ElementBaseShape;
            if (element != null)
            {
                var rect = element.GetRectangle();
                var placeholder = new Rect(rect.TopLeft, rect.Size);
                if ((direction & ResizeDirection.Top) == ResizeDirection.Top)
                {
                    placeholder.Y += vector.Y;
                    placeholder.Height -= vector.Y;
                }
                else if ((direction & ResizeDirection.Bottom) == ResizeDirection.Bottom)
                    placeholder.Height += vector.Y;
                if ((direction & ResizeDirection.Left) == ResizeDirection.Left)
                {
                    placeholder.X += vector.X;
                    placeholder.Width -= vector.X;
                }
                else if ((direction & ResizeDirection.Right) == ResizeDirection.Right)
                    placeholder.Width += vector.X;
                double kx = rect.Width == 0 ? 0 : placeholder.Width / rect.Width;
                double ky = rect.Height == 0 ? 0 : placeholder.Height / rect.Height;

                PointCollection points = new PointCollection();
                foreach (var point in element.Points)
                    points.Add(new Point(placeholder.X + kx * (point.X - rect.X), placeholder.Y + ky * (point.Y - rect.Y)));
                element.Points = points;

                DesignerItem.Redraw();
                ServiceFactory.SaveService.PlansChanged = true;
            }
        }
开发者ID:hjlfmy,项目名称:Rubezh,代码行数:33,代码来源:ResizeChromeShape.cs


示例3: Resize

		protected override void Resize(ResizeDirection direction, Vector vector)
		{
			ElementBaseRectangle element = DesignerItem.Element as ElementBaseRectangle;
			if (element != null)
			{
				if ((direction & ResizeDirection.Top) == ResizeDirection.Top)
				{
					element.Top += vector.Y;
					element.Height -= vector.Y;
				}
				else if ((direction & ResizeDirection.Bottom) == ResizeDirection.Bottom)
					element.Height += vector.Y;
				if ((direction & ResizeDirection.Left) == ResizeDirection.Left)
				{
					element.Left += vector.X;
					element.Width -= vector.X;
				}
				else if ((direction & ResizeDirection.Right) == ResizeDirection.Right)
					element.Width += vector.X;
				if (element.Height < 0)
					element.Height = 0;
				if (element.Width < 0)
					element.Width = 0;
				DesignerItem.RefreshPainter();
				DesignerCanvas.DesignerChanged();
			}
		}
开发者ID:xbadcode,项目名称:Rubezh,代码行数:27,代码来源:ResizeChromeRectangle.cs


示例4: DiagramMouseManager

        public DiagramMouseManager(Diagram diagram)
        {
            _diagram = diagram;

            _currentResizeDirection = ResizeDirection.None;

            _leftButtonAction = MouseAction.None;
            _rightButtonAction = MouseAction.None;

            _leftButtonDown = false;
            _rightButtonDown = false;
            _leftButtonDownMousePosition = null;

            _currentMousePosition = null;
            _leftButtonDownMousePosition = null;

            _itemUnderCursor = null;

            _baseXViewOffset = 0;
            _baseYViewOffset = 0;

            _offsetWorker = null;

            Selector = null;
        }
开发者ID:GilbertTeam,项目名称:Tales-Generator,代码行数:25,代码来源:DiagramMouseManager.cs


示例5: Resize

 protected override void Resize(ResizeDirection direction, Vector vector)
 {
     ElementBasePoint element = DesignerItem.Element as ElementBasePoint;
     if (element != null)
     {
         if ((direction & ResizeDirection.Top) == ResizeDirection.Top || (direction & ResizeDirection.Bottom) == ResizeDirection.Bottom)
             element.Top += vector.Y;
         if ((direction & ResizeDirection.Left) == ResizeDirection.Left || (direction & ResizeDirection.Right) == ResizeDirection.Right)
             element.Left += vector.X;
         DesignerItem.SetLocation();
         ServiceFactory.SaveService.PlansChanged = true;
     }
 }
开发者ID:hjlfmy,项目名称:Rubezh,代码行数:13,代码来源:ResizeChromePoint.cs


示例6: Resize

		protected override void Resize(ResizeDirection direction, Vector vector)
		{
			ElementBasePoint element = DesignerItem.Element as ElementBasePoint;
			if (element != null)
			{
				if ((direction & ResizeDirection.Top) == ResizeDirection.Top || (direction & ResizeDirection.Bottom) == ResizeDirection.Bottom)
					element.Top += vector.Y;
				if ((direction & ResizeDirection.Left) == ResizeDirection.Left || (direction & ResizeDirection.Right) == ResizeDirection.Right)
					element.Left += vector.X;
				//DesignerItem.Translate();
				DesignerItem.RefreshPainter();
				DesignerCanvas.DesignerChanged();
			}
		}
开发者ID:xbadcode,项目名称:Rubezh,代码行数:14,代码来源:ResizeChromePoint.cs


示例7: WindowX

 /// <summary>
 /// Constructs a WindowX form instance
 /// </summary>
 public WindowX()
 {
     _buttonColor = startColor;
     _hoverColor = Color.FromArgb(80, 80, 80);
     _pushColor = Color.White;
     _aeroEnabled = false;
     _resizeDir = ResizeDirection.None;
     ClientSize = new Size(640, 480);
     MouseMove += new MouseEventHandler(OnMouseMove);
     MouseDown += new MouseEventHandler(OnMouseDown);
     Activated += new EventHandler(OnActivated);
     SetStyle(ControlStyles.ResizeRedraw, true);
     AutoScaleDimensions = new SizeF(6f, 13f);
     Font = new Font("Segoe UI", 8f, FontStyle.Regular, GraphicsUnit.Point);
     AutoScaleMode = AutoScaleMode.Font;
     BackColor = Color.White;
     StartPosition = FormStartPosition.CenterScreen;
     SetupButtons();
     DoubleBuffered = true;
 }
开发者ID:panshuiqing,项目名称:WinFormsX,代码行数:23,代码来源:WindowX.cs


示例8: InitializeResize

        public override void InitializeResize(System.Collections.Generic.IEnumerable<IDiagramItem> newSelectedItems, double adornerAngle, Rect adornerBounds, ResizeDirection resizingDirection, Point startPoint)
        {
            this.mainContainer = newSelectedItems.FirstOrDefault() as MainContainerShapeBase;
            if (this.mainContainer != null)
                this.mainContainer.UpdateMinBounds();

            base.InitializeResize(newSelectedItems, adornerAngle, adornerBounds, resizingDirection, startPoint);

            if (this.mainContainer != null)
            {
                var firstChild = this.mainContainer.OrderedChildren.FirstOrDefault();
                var lastChild = this.mainContainer.OrderedChildren.LastOrDefault();

                if (firstChild != null && lastChild != null)
                {
                    this.restrictResize = true;
                    this.startBounds = this.mainContainer.ContentBounds;

                    if (this.mainContainer.ChildrenPositioning == System.Windows.Controls.Orientation.Vertical)
                    {
                        this.isFirstChildResize = resizingDirection == ResizeDirection.NorthEastSouthWest || resizingDirection == ResizeDirection.NorthWestSouthEast;
                        this.min = firstChild.MinBoundsWithChildren != Rect.Empty ? firstChild.MinBoundsWithChildren.Top : firstChild.Bounds.Bottom - CustomResizingService.MinShapeHeight;
                        this.max = lastChild.MinBoundsWithChildren != Rect.Empty ? lastChild.MinBoundsWithChildren.Bottom : lastChild.Bounds.Top + CustomResizingService.MinShapeHeight;
                    }
                    else
                    {
                        this.isFirstChildResize = resizingDirection == ResizeDirection.SouthWestNorthEast || resizingDirection == ResizeDirection.NorthWestSouthEast;
                        this.min = firstChild.MinBoundsWithChildren != Rect.Empty ? firstChild.MinBoundsWithChildren.Left : firstChild.Bounds.Right - CustomResizingService.MinShapeWidth;
                        this.max = lastChild.MinBoundsWithChildren != Rect.Empty ? lastChild.MinBoundsWithChildren.Right : lastChild.Bounds.Left + CustomResizingService.MinShapeWidth;
                    }
                    this.CreateResizeCommand();
                }
                else
                {
                    this.restrictResize = false;
                }
            }

            //this.isFirstResize = true;
        }
开发者ID:netintellect,项目名称:PluralsightSpaJumpStartFinal,代码行数:40,代码来源:CustomResizingService.cs


示例9: OnMouseUp

		/// <summary>
		/// Mouse up event handler.
		/// </summary>
		/// <param name="e">Event args</param>
		/// <returns>If this widget handled this event</returns>
		public bool OnMouseUp(System.Windows.Forms.MouseEventArgs e)
		{
			// if we aren't active do nothing.
			if ((!m_visible) || (!m_enabled))
				return false;

			int widgetTop = this.Top;
			int widgetBottom = this.Bottom;
			int widgetLeft = this.Left;
			int widgetRight = this.Right;

            // Check for close if header is rendered
			if(HeaderEnabled &&
                m_lastMouseDownPosition.X >= Location.X + m_size.Width - 18 &&
                m_lastMouseDownPosition.X <= AbsoluteLocation.X + m_size.Width &&
                m_lastMouseDownPosition.Y >= AbsoluteLocation.Y &&
                m_lastMouseDownPosition.Y <= AbsoluteLocation.Y + m_currHeaderHeight - 2)
			{
				Visible = false;
                m_isDragging = false;
                
                if (DestroyOnClose)
				{
					Enabled = false;

					WidgetCollection parentCollection = (WidgetCollection) m_parentWidget;
					if (parentCollection != null)
						parentCollection.Remove(this);

					this.Dispose();
				}
                m_lastMouseDownPosition = System.Drawing.Point.Empty;
                return true;
			}

			// reset scrolling flags (don't care what up button event it is)
			m_isVScrolling = false;
			m_isHScrolling = false;

			// if its the left mouse button then reset dragging and resizing
			if (((m_isDragging) || (m_resize != ResizeDirection.None)) && 
				(e.Button == System.Windows.Forms.MouseButtons.Left))
			{
				// reset dragging flags
				m_isDragging = false;
				m_resize = ResizeDirection.None;
                m_lastMouseDownPosition = System.Drawing.Point.Empty;
				return true;
			}

			// if we're in the client area handle let the children try 
			if(e.X >= widgetLeft &&
				e.X <= widgetRight &&
				e.Y >= widgetTop &&
				e.Y <= widgetBottom)
			{
                for(int i = m_ChildWidgets.Count - 1; i >= 0; i--)
				{
					if(m_ChildWidgets[i] is WorldWind.NewWidgets.IInteractive)
					{
						WorldWind.NewWidgets.IInteractive currentInteractive = m_ChildWidgets[i] as WorldWind.NewWidgets.IInteractive;
                        if (currentInteractive.OnMouseUp(e))
                        {
                            m_lastMouseDownPosition = System.Drawing.Point.Empty;
                            return true;
                        }
					}
				}
			}
            m_lastMouseDownPosition = System.Drawing.Point.Empty;
			return false;
		}
开发者ID:jpespartero,项目名称:WorldWind,代码行数:77,代码来源:FormWidget.cs


示例10: ResizeWindow

 private void ResizeWindow(ResizeDirection direction)
 {
     NativeMethods.SendMessage(this.hwndSource.Handle, WM_SYSCOMMAND, (IntPtr)(61440 + direction), IntPtr.Zero);
 }
开发者ID:andysoftdev,项目名称:ht4n,代码行数:4,代码来源:ChromeWindow.cs


示例11: OnMouseDown

		/// <summary>
		/// Mouse down event handler.
		/// </summary>
		/// <param name="e">Event args</param>
		/// <returns>If this widget handled this event</returns>
		public bool OnMouseDown(System.Windows.Forms.MouseEventArgs e)
		{
			// Whether or not the event was handled
			bool handled = false;

			// Whether or not we're in the form
			bool inClientArea = false;

			// if we aren't active do nothing.
			if ((!m_visible) || (!m_enabled))
				return false;

			int widgetTop = this.Top;
			int widgetBottom = this.Bottom;
			int widgetLeft = this.Left;
			int widgetRight = this.Right;

            m_lastMouseDownPosition = new Point(e.X, e.Y);

			// if we're in the client area bring to front
			if(e.X >= widgetLeft &&
				e.X <= widgetRight &&
				e.Y >= widgetTop &&
				e.Y <= widgetBottom)
			{
				if (m_parentWidget != null)
					m_parentWidget.ChildWidgets.BringToFront(this);

				inClientArea = true;
			}

			// if its the left mouse button check for UI actions (resize, drags, etc) 
			if(e.Button == System.Windows.Forms.MouseButtons.Left)
			{
				// Reset dragging and resizing
				m_isDragging = false;
				m_resize = ResizeDirection.None;

				// Reset scrolling
				m_isVScrolling = false;
				m_isHScrolling = false;

				#region resize and dragging

				// Check for resize (pointer is just outside the form)
				if(e.X > widgetLeft - resizeBuffer &&
					e.X < widgetLeft + resizeBuffer &&
					e.Y > widgetTop - resizeBuffer &&
					e.Y < widgetTop + resizeBuffer)
				{
					if ((HorizontalResizeEnabled) && (VerticalResizeEnabled))
						m_resize = ResizeDirection.UL;
					else if (HorizontalResizeEnabled)
						m_resize = ResizeDirection.Left;
					else if (VerticalResizeEnabled)
						m_resize = ResizeDirection.Up;
				}
				else if(e.X > widgetRight - resizeBuffer &&
					e.X < widgetRight + resizeBuffer &&
					e.Y > widgetTop - resizeBuffer &&
					e.Y < widgetTop + resizeBuffer)
				{
					if ((HorizontalResizeEnabled) && (VerticalResizeEnabled))
						m_resize = ResizeDirection.UR;
					else if (HorizontalResizeEnabled)
						m_resize = ResizeDirection.Right;
					else if (VerticalResizeEnabled)
						m_resize = ResizeDirection.Up;
				}
				else if(e.X > widgetLeft - resizeBuffer &&
					e.X < widgetLeft + resizeBuffer &&
					e.Y > widgetBottom - resizeBuffer &&
					e.Y < widgetBottom + resizeBuffer)
				{
					if ((HorizontalResizeEnabled) && (VerticalResizeEnabled))
						m_resize = ResizeDirection.DL;
					else if (HorizontalResizeEnabled)
						m_resize = ResizeDirection.Left;
					else if (VerticalResizeEnabled)
						m_resize = ResizeDirection.Down;
				}
				else if(e.X > widgetRight - resizeBuffer &&
					e.X < widgetRight + resizeBuffer &&
					e.Y > widgetBottom - resizeBuffer &&
					e.Y < widgetBottom + resizeBuffer )
				{
					if ((HorizontalResizeEnabled) && (VerticalResizeEnabled))
						m_resize = ResizeDirection.DR;
					else if (HorizontalResizeEnabled)
						m_resize = ResizeDirection.Right;
					else if (VerticalResizeEnabled)
						m_resize = ResizeDirection.Down;
				}
				else if(e.X > AbsoluteLocation.X - resizeBuffer &&
					e.X < AbsoluteLocation.X + resizeBuffer &&
//.........这里部分代码省略.........
开发者ID:jpespartero,项目名称:WorldWind,代码行数:101,代码来源:FormWidget.cs


示例12: TransparencySlider_MouseHover

 private void TransparencySlider_MouseHover(object sender, EventArgs e)
 {
     ResizeDir = ResizeDirection.None;
     Cursor = Cursors.Default;
 }
开发者ID:Type-of-Tool,项目名称:ootd,代码行数:5,代码来源:MainForm.cs


示例13: ResizeWindow

 private void ResizeWindow(ResizeDirection direction)
 {
     Console.WriteLine("direction:" + direction.ToString());
     SendMessage(_hwndSource.Handle, 0x112, (IntPtr)(61440 + direction), IntPtr.Zero);
 }
开发者ID:JackTing,项目名称:suWpfExt,代码行数:5,代码来源:MainWindow.xaml.cs


示例14: HeaderPanel_MouseMove

 private void HeaderPanel_MouseMove(object sender, MouseEventArgs e)
 {
     ResizeDir = ResizeDirection.None;
     Cursor = Cursors.SizeAll;
 }
开发者ID:Type-of-Tool,项目名称:ootd,代码行数:5,代码来源:MainForm.cs


示例15: SetResizeMode

 /// <summary>
 /// 
 /// </summary>
 /// <param name="element"></param>
 /// <param name="value"></param>
 public static void SetResizeMode(DependencyObject element, ResizeDirection value)
 {
     element.SetValue(ResizeModeProperty, value);
 }
开发者ID:nankezhishi,项目名称:ClearMine,代码行数:9,代码来源:ThumbExt.cs


示例16: CalculateSize

 private Vector CalculateSize(ResizeDirection direction, double horizontalChange, double verticalChange)
 {
     double dragDeltaHorizontal = horizontalChange;
     double dragDeltaVertical = verticalChange;
     foreach (DesignerItem designerItem in DesignerCanvas.SelectedItems)
     {
         Rect rect = new Rect(Canvas.GetLeft(designerItem), Canvas.GetTop(designerItem), designerItem.ActualWidth, designerItem.ActualHeight);
         if ((direction & ResizeDirection.Top) == ResizeDirection.Top)
         {
             if (rect.Height - dragDeltaVertical < DesignerItem.MinHeight)
                 dragDeltaVertical = rect.Height - DesignerItem.MinHeight;
             if (rect.Top + dragDeltaVertical < 0)
                 dragDeltaVertical = -rect.Top;
         }
         else if ((direction & ResizeDirection.Bottom) == ResizeDirection.Bottom)
         {
             if (rect.Height + dragDeltaVertical < DesignerItem.MinHeight)
                 dragDeltaVertical = DesignerItem.MinHeight - rect.Height;
             if (rect.Bottom + dragDeltaVertical > DesignerCanvas.Height)
                 dragDeltaVertical = DesignerCanvas.Height - rect.Bottom;
         }
         if ((direction & ResizeDirection.Left) == ResizeDirection.Left)
         {
             if (rect.Width - dragDeltaHorizontal < DesignerItem.MinWidth)
                 dragDeltaHorizontal = rect.Width - DesignerItem.MinWidth;
             if (rect.Left + dragDeltaHorizontal < 0)
                 dragDeltaHorizontal = -rect.Left;
         }
         else if ((direction & ResizeDirection.Right) == ResizeDirection.Right)
         {
             if (rect.Width + dragDeltaHorizontal < DesignerItem.MinWidth)
                 dragDeltaHorizontal = DesignerItem.MinWidth - rect.Width;
             if (rect.Right + dragDeltaHorizontal > DesignerCanvas.Width)
                 dragDeltaHorizontal = DesignerCanvas.Width - rect.Right;
         }
     }
     return new Vector(dragDeltaHorizontal, dragDeltaVertical);
 }
开发者ID:hjlfmy,项目名称:Rubezh,代码行数:38,代码来源:ResizeChrome.cs


示例17: OnMouseMove

        protected override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);

            if (DesignMode) return;

	        if (Sizable)
	        {
				//True if the mouse is hovering over a child control
				bool isChildUnderMouse = GetChildAtPoint(e.Location) != null;
                if (!Resize_Enabled)
                {
                    resizeDir = ResizeDirection.None;

                    //Only reset the cursur when needed, this prevents it from flickering when a child control changes the cursor to its own needs
                    if (resizeCursors.Contains(Cursor))
                    {
                        Cursor = Cursors.Default;
                    }
                }
                else
                {
                    if (e.Location.X < BORDER_WIDTH && e.Location.Y > Height - BORDER_WIDTH && !isChildUnderMouse && !Maximized)
                    {
                        resizeDir = ResizeDirection.BottomLeft;
                        Cursor = Cursors.SizeNESW;
                    }
                    else if (e.Location.Y < BORDER_WIDTH && e.Location.X < BORDER_WIDTH && !isChildUnderMouse && !Maximized)
                    {
                        resizeDir = ResizeDirection.TopLeft;
                        Cursor = Cursors.SizeNWSE;
                    }
                    else if (e.Location.Y < BORDER_WIDTH && e.Location.X > Width - BORDER_WIDTH && !isChildUnderMouse && !Maximized)
                    {
                        resizeDir = ResizeDirection.TopRight;
                        Cursor = Cursors.SizeNESW;
                    }
                    else if (e.Location.X < BORDER_WIDTH && !isChildUnderMouse && !Maximized)
                    {
                        resizeDir = ResizeDirection.Left;
                        Cursor = Cursors.SizeWE;
                    }
                    else if (e.Location.X > Width - BORDER_WIDTH && e.Location.Y > Height - BORDER_WIDTH && !isChildUnderMouse && !Maximized)
                    {
                        resizeDir = ResizeDirection.BottomRight;
                        Cursor = Cursors.SizeNWSE;
                    }
                    else if (e.Location.X > Width - BORDER_WIDTH && !isChildUnderMouse && !Maximized)
                    {
                        resizeDir = ResizeDirection.Right;
                        Cursor = Cursors.SizeWE;
                    }
                    else if (e.Location.Y > Height - BORDER_WIDTH && !isChildUnderMouse && !Maximized)
                    {
                        resizeDir = ResizeDirection.Bottom;
                        Cursor = Cursors.SizeNS;
                    }
                    else if (e.Location.Y < BORDER_WIDTH && !isChildUnderMouse && !Maximized)
                    {
                        resizeDir = ResizeDirection.Top;
                        Cursor = Cursors.SizeNS;
                    }
                    else
                    {
                        resizeDir = ResizeDirection.None;

                        //Only reset the cursur when needed, this prevents it from flickering when a child control changes the cursor to its own needs
                        if (resizeCursors.Contains(Cursor))
                        {
                            Cursor = Cursors.Default;
                        }
                    }
                }
	        }

            UpdateButtons(e);
        }
开发者ID:SoumikMukherjeeDOTNET,项目名称:Google-Play-Music-Desktop-Player-UNOFFICIAL-,代码行数:77,代码来源:MaterialForm.cs


示例18: ResizeWindow

 /// <summary>
 /// Resizes the window in a given direction.
 /// </summary>
 /// <param name="direction">
 /// The direction.
 /// </param>
 private void ResizeWindow(ResizeDirection direction)
 {
     SendMessage(new WindowInteropHelper(this).Handle, WmSyscommand, (IntPtr)(61440 + direction), IntPtr.Zero);
 }
开发者ID:haplo63,项目名称:OCTGN,代码行数:10,代码来源:OctgnChrome.cs


示例19: setReziseDirection

		internal void setReziseDirection(Point p)
		{

			Rectangle r = new Rectangle(0, 0, 0, 0);
			Rectangle r1 = new Rectangle(r.Location.X - CORNER_SQUARE_SIZE, r.Location.Y - CORNER_SQUARE_SIZE, CORNER_SQUARE_SIZE, CORNER_SQUARE_SIZE);
			if (r1.Contains(p)) {
				resizeDirection = ResizeDirection.NW;
				return;
			}
			Rectangle r2 = new Rectangle(r.Location.X + r.Width, r.Location.Y - CORNER_SQUARE_SIZE, CORNER_SQUARE_SIZE, CORNER_SQUARE_SIZE);
			if (r2.Contains(p)) {
				resizeDirection = ResizeDirection.NE;
				return;
			}          
			Rectangle r3 = new Rectangle(r.Location.X + (r.Width - CORNER_SQUARE_SIZE) / 2, r.Location.Y - CORNER_SQUARE_SIZE, CORNER_SQUARE_SIZE, CORNER_SQUARE_SIZE);
			if (r3.Contains(p)) {
				resizeDirection = ResizeDirection.N;
				return;
			} 
			Rectangle r4 = new Rectangle(r.Location.X - CORNER_SQUARE_SIZE, r.Location.Y + r.Size.Height, CORNER_SQUARE_SIZE, CORNER_SQUARE_SIZE);
			if (r4.Contains(p)) {
				resizeDirection = ResizeDirection.SW;
				return;
			} 
			Rectangle r5 = new Rectangle(r.Location.X - CORNER_SQUARE_SIZE, r.Location.Y + (r.Size.Height - CORNER_SQUARE_SIZE) / 2, CORNER_SQUARE_SIZE, CORNER_SQUARE_SIZE);
			if (r5.Contains(p)) {
				resizeDirection = ResizeDirection.W;
				return;
			} 
			Rectangle r6 = new Rectangle(r.Location.X + r.Width, r.Location.Y + r.Size.Height, CORNER_SQUARE_SIZE, CORNER_SQUARE_SIZE);
			if (r6.Contains(p)) {
				resizeDirection = ResizeDirection.SE;
				return;
			}
			Rectangle r7 = new Rectangle(r.Location.X + (r.Width - CORNER_SQUARE_SIZE) / 2, r.Location.Y + r.Size.Height, CORNER_SQUARE_SIZE, CORNER_SQUARE_SIZE);
			if (r7.Contains(p)) {
				resizeDirection = ResizeDirection.S;
				return;
			}
			Rectangle r8 = new Rectangle(r.Location.X + r.Size.Width, r.Location.Y + (r.Size.Height - CORNER_SQUARE_SIZE) / 2, CORNER_SQUARE_SIZE, CORNER_SQUARE_SIZE);
			if (r8.Contains(p)) {
				resizeDirection = ResizeDirection.E;
				return;
			}

			resizeDirection = ResizeDirection.NONE;
		}
开发者ID:lvoinescu,项目名称:samDiagrams,代码行数:47,代码来源:SelectionBorder.cs


示例20: ResizeForm

        private void ResizeForm(ResizeDirection direction)
        {
            if (GlobalPreferences.LockPosition) return;

            int dir = -1;
            switch (direction)
            {
                case ResizeDirection.Left:
                    dir = UnsafeNativeMethods.HTLEFT;
                    break;
                case ResizeDirection.TopLeft:
                    dir = UnsafeNativeMethods.HTTOPLEFT;
                    break;
                case ResizeDirection.Top:
                    dir = UnsafeNativeMethods.HTTOP;
                    break;
                case ResizeDirection.TopRight:
                    dir = UnsafeNativeMethods.HTTOPRIGHT;
                    break;
                case ResizeDirection.Right:
                    dir = UnsafeNativeMethods.HTRIGHT;
                    break;
                case ResizeDirection.BottomRight:
                    dir = UnsafeNativeMethods.HTBOTTOMRIGHT;
                    break;
                case ResizeDirection.Bottom:
                    dir = UnsafeNativeMethods.HTBOTTOM;
                    break;
                case ResizeDirection.BottomLeft:
                    dir = UnsafeNativeMethods.HTBOTTOMLEFT;
                    break;
            }

            if (dir != -1)
            {
                UnsafeNativeMethods.ReleaseCapture();
                UnsafeNativeMethods.SendMessage(Handle, UnsafeNativeMethods.WM_NCLBUTTONDOWN, (IntPtr)dir, IntPtr.Zero);
            }
        }
开发者ID:Type-of-Tool,项目名称:ootd,代码行数:39,代码来源:MainForm.cs



注:本文中的ResizeDirection类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ResizeSettings类代码示例发布时间:2022-05-24
下一篇:
C# ResistanceType类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap