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


C# PreviewPoint.ToPoint方法代码示例

本文整理汇总了C#中VixenModules.Preview.VixenPreview.Shapes.PreviewPoint.ToPoint方法的典型用法代码示例。如果您正苦于以下问题:C# PreviewPoint.ToPoint方法的具体用法?C# PreviewPoint.ToPoint怎么用?C# PreviewPoint.ToPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在VixenModules.Preview.VixenPreview.Shapes.PreviewPoint的用法示例。


在下文中一共展示了PreviewPoint.ToPoint方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: VixenPreviewControl_MouseDown

		private void VixenPreviewControl_MouseDown(object sender, MouseEventArgs e)
		{
			if (_editMode)
			{
				bool controlPressed = (Control.ModifierKeys == Keys.Control);
				PreviewPoint translatedPoint = new PreviewPoint(e.X + hScroll.Value, e.Y + vScroll.Value);
				if (e.Button == System.Windows.Forms.MouseButtons.Left)
				{
					if (_currentTool == Tools.Select)
					{
						if (controlPressed)
						{
							DisplayItem item = DisplayItemAtPoint(translatedPoint);
							if (item != null && SelectedDisplayItems.Contains(item))
							{
								SelectedDisplayItems.Remove(item);
							}
							else
							{
								SelectItemUnderPoint(translatedPoint, controlPressed);
							}
							return;
						}

						// Is there a single dislay item selected?
						if (_selectedDisplayItem != null && !controlPressed)
						{
							// Lets see if we've got a drag point.
							PreviewPoint selectedPoint = _selectedDisplayItem.Shape.PointInSelectPoint(translatedPoint);
							if (selectedPoint != null)
							{
								modifyType = "Resize";
								beginResize_Move(false); //Starts the Undo Process
								dragStart = translatedPoint.ToPoint();
								_selectedDisplayItem.Shape.SetSelectPoint(selectedPoint);
								Capture = true;
								_mouseCaptured = true;
							}
								// If we're not resizing, see if we're moving a single shape
							else if (_selectedDisplayItem.Shape.PointInShape(translatedPoint))
							{
								modifyType = "Move";
								beginResize_Move(false); //Starts the Undo Process

								StartMove(translatedPoint.X, translatedPoint.Y);
							}
								// If we get here, we're outside the shape, deselect
							else
							{
								DeSelectSelectedDisplayItem();
							}
						}
							// Are there multiple items selected?
							// If so, we're moving, can't resize them...
						else if (SelectedDisplayItems.Count > 1 && !controlPressed)
						{
							//if (MouseOverSelectedDisplayItems(e.X, e.Y)) {
							//    StartMove(e.X, e.Y);
							//}
							//else {
							//    SelectedDisplayItems.Clear();
							//}
							if (MouseOverSelectedDisplayItems(translatedPoint.X, translatedPoint.Y))
							{
								modifyType = "Move";
								beginResize_Move(true); //Starts the Undo Process
								StartMove(translatedPoint.X, translatedPoint.Y);
							}
							else
							{
								SelectedDisplayItems.Clear();
							}
						}

						SelectItemUnderPoint(translatedPoint, controlPressed);

						// If we get this far, and we've got nothing selected, we're drawing a rubber band!
						if (_selectedDisplayItem == null && SelectedDisplayItems.Count == 0)
						{
							// Capture the mouse in case we want to draw a rubber band
							dragStart = translatedPoint.ToPoint();
							Capture = true;
							_mouseCaptured = true;
							SelectedDisplayItems.Clear();
							_bandRect.Width = 0;
							_bandRect.Height = 0;
							_banding = true;
						}
					}

					else if (_selectedDisplayItem != null && _selectedDisplayItem.Shape.PointInShape(translatedPoint) &&
					         !_selectedDisplayItem.Shape.Creating)
					{
						StartMove(translatedPoint.X, translatedPoint.Y);
					}

						// If we're not Selecting items, we're drawing them
					else if (_currentTool == Tools.PolyLine && _mouseCaptured)
					{
						return;
//.........这里部分代码省略.........
开发者ID:stewmc,项目名称:vixen,代码行数:101,代码来源:VixenPreviewControl.cs

示例2: VixenPreviewControl_MouseMove

		private void VixenPreviewControl_MouseMove(object sender, MouseEventArgs e)
		{
			if (_editMode)
			{
				PreviewPoint translatedPoint = new PreviewPoint(e.X + hScroll.Value, e.Y + vScroll.Value);
				Point zoomPoint = PointToZoomPoint(translatedPoint.ToPoint());
				if (e.Button == System.Windows.Forms.MouseButtons.Middle)
				{
					// Woo hoo... we're panning with the middle mouse button
					// Set the new background position based on the mouse position
					SetBackgroundPosition(zoomTo, MousePosition);
				}
				else
				{
					dragCurrent.X = translatedPoint.X;
					dragCurrent.Y = translatedPoint.Y;
					changeX = translatedPoint.X - dragStart.X;
					changeY = translatedPoint.Y - dragStart.Y;

					// Are we moving a single display item?
					if (_mouseCaptured && _selectedDisplayItem != null)
					{
						_selectedDisplayItem.Shape.MouseMove(dragCurrent.X, dragCurrent.Y, changeX, changeY);
					}
						// If we get here, we're drwing a rubber band
					else if (_banding)
					{
						int X1 = Math.Min(dragStart.X, dragStart.X + changeX);
						int Y1 = Math.Min(dragStart.Y, dragStart.Y + changeY);

						_bandRect.Location = new Point(X1, Y1);
						_bandRect.Width = Math.Abs(changeX);
						_bandRect.Height = Math.Abs(changeY);

						foreach (DisplayItem item in DisplayItems)
						{
							if (
								(changeX < 0 && item.Shape.ShapeInRect(_bandRect)) ||
								(changeX > 0 && item.Shape.ShapeAllInRect(_bandRect))
								)
							{
								if (!SelectedDisplayItems.Contains(item))
								{
									SelectedDisplayItems.Add(item);
								}
							}
							else if (SelectedDisplayItems.Contains(item))
							{
								SelectedDisplayItems.Remove(item);
							}
						}
					}
						// Are we moving a group of display items?
					else if (_mouseCaptured && _selectedDisplayItem == null && SelectedDisplayItems.Count() > 0)
					{
						foreach (DisplayItem item in SelectedDisplayItems)
						{
							item.Shape.MouseMove(zoomPoint.X, zoomPoint.Y, changeX, changeY);
						}
					}

					if (_selectedDisplayItem != null)
					{
						PreviewPoint selectPoint = _selectedDisplayItem.Shape.PointInSelectPoint(translatedPoint);
						if (selectPoint != null)
						{
							Cursor.Current = Cursors.Cross;
						}
						else if (_selectedDisplayItem.Shape.PointInShape(translatedPoint))
						{
							Cursor.Current = Cursors.SizeAll;
						}
						else
						{
							Cursor.Current = Cursors.Default;
						}
					}
					else if (SelectedDisplayItems.Count > 0)
					{
						if (MouseOverSelectedDisplayItems(translatedPoint.X, translatedPoint.Y))
						{
							Cursor.Current = Cursors.SizeAll;
						}
					}
				}
			}
		}
开发者ID:stewmc,项目名称:vixen,代码行数:87,代码来源:VixenPreviewControl.cs

示例3: VixenPreviewControl_MouseDown

        private void VixenPreviewControl_MouseDown(object sender, MouseEventArgs e)
        {
            if (_editMode)
            {
                bool controlPressed = (Control.ModifierKeys == Keys.Control);
                PreviewPoint translatedPoint = new PreviewPoint(e.X + hScroll.Value, e.Y + vScroll.Value);
                if (e.Button == System.Windows.Forms.MouseButtons.Left)
                {
                    if (_currentTool == Tools.Select)
                    {
                        if (controlPressed)
                        {
                            DisplayItem item = DisplayItemAtPoint(translatedPoint);
                            if (item != null && SelectedDisplayItems.Contains(item))
                            {
                                SelectedDisplayItems.Remove(item);
                            }
                            else
                            {
                                SelectItemUnderPoint(translatedPoint, controlPressed);
                            }
                            return;
                        }

                        // Is there a single dislay item selected?
                        if (_selectedDisplayItem != null && !controlPressed)
                        {
                            // Lets see if we've got a drag point.
                            PreviewPoint selectedPoint = _selectedDisplayItem.Shape.PointInSelectPoint(translatedPoint);
                            if (selectedPoint != null)
                            {
                                dragStart = translatedPoint.ToPoint();
                                _selectedDisplayItem.Shape.SetSelectPoint(selectedPoint);
                                Capture = true;
                                _mouseCaptured = true;
                            }
                            // If we're not resizing, see if we're moving a single shape
                            else if (_selectedDisplayItem.Shape.PointInShape(translatedPoint))
                            {
                                StartMove(translatedPoint.X, translatedPoint.Y);
                            }
                            // If we get here, we're outside the shape, deselect
                            else
                            {
                                DeSelectSelectedDisplayItem();
                            }
                        }
                        // Are there multiple items selected?
                        // If so, we're moving, can't resize them...
                        else if (SelectedDisplayItems.Count > 1 && !controlPressed)
                        {
                            //if (MouseOverSelectedDisplayItems(e.X, e.Y)) {
                            //    StartMove(e.X, e.Y);
                            //}
                            //else {
                            //    SelectedDisplayItems.Clear();
                            //}
                            if (MouseOverSelectedDisplayItems(translatedPoint.X, translatedPoint.Y))
                            {
                                StartMove(translatedPoint.X, translatedPoint.Y);
                            }
                            else
                            {
                                SelectedDisplayItems.Clear();
                            }
                        }

                        SelectItemUnderPoint(translatedPoint, controlPressed);

                        // If we get this far, and we've got nothing selected, we're drawing a rubber band!
                        if (_selectedDisplayItem == null && SelectedDisplayItems.Count == 0)
                        {
                            // Capture the mouse in case we want to draw a rubber band
                            dragStart = translatedPoint.ToPoint();
                            Capture = true;
                            _mouseCaptured = true;
                            SelectedDisplayItems.Clear();
                            _bandRect.Width = 0;
                            _bandRect.Height = 0;
                            _banding = true;
                        }
                    }

                    else if (_selectedDisplayItem != null && _selectedDisplayItem.Shape.PointInShape(translatedPoint) && !_selectedDisplayItem.Shape.Creating)
                    {
                        StartMove(translatedPoint.X, translatedPoint.Y);
                    }

                    // If we're not Selecting items, we're drawing them
                    else if (_currentTool == Tools.PolyLine && _mouseCaptured)
                    {
                        return;
                    }
                    else if (_currentTool == Tools.MultiString && _mouseCaptured)
                    {
                        return;
                    }
                    else
                    {
                        DeSelectSelectedDisplayItem();
//.........这里部分代码省略.........
开发者ID:komby,项目名称:vixen,代码行数:101,代码来源:VixenPreviewControl.cs


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