当前位置: 首页>>代码示例>>C#>>正文


C# ResizeDirection类代码示例

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


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


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