Esempio n. 1
0
        public void Draw(Graphics g, Point offset, DrawingSurface surface)
        {
            Point p = Location;

            p.Offset(offset);

            Rectangle r = new Rectangle(p, Size);

            if (surface == DrawingSurface.Screen)
            {
                g.FillRectangle(Brushes.White, r);
                g.DrawRectangle(Pens.Black, r);
            }

            string text = string.IsNullOrEmpty(Format) ? Text : string.Format(Format, Text);

            g.DrawString(text, Font, Brushes.Black, p);

            if (Selected && surface == DrawingSurface.Screen)
            {
                g.DrawRectangles(Pens.Black, r.ToRectArray(new Size(5, 5)).ToArray());
            }
        }
Esempio n. 2
0
        public void SaveGraph(string filematrix, string filePoint)
        {
            GraphData data = new GraphData();

            data.IsUndirectedGraph = IsUndirectedGraph;

            for (int i = 0; i < this.Controls.Count; i++)
            {
                Point p = this.Controls[i].Location;
                p.Offset(NODE_RADIUS, NODE_RADIUS);

                data.NodeLocations.Add(p);
            }
            data.graph = _graph;
            try
            {
                data.SaveData(filematrix, filePoint);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Esempio n. 3
0
        public override bool Layout(object container, LayoutEventArgs layoutEventArgs)
        {
            Control parent = container as Control;

            // Use DisplayRectangle so that parent.Padding is honored.
            Rectangle parentDisplayRectangle = parent.DisplayRectangle;
            Point     nextControlLocation    = parentDisplayRectangle.Location;

            foreach (Control c in parent.Controls.Cast <Control>().Where(c => c.Visible).Reverse())
            {
                nextControlLocation.Offset(c.Margin.Left, c.Margin.Top);
                c.Location = nextControlLocation;

                if (c.AutoSize)
                {
                    c.Size = c.GetPreferredSize(parentDisplayRectangle.Size);
                }

                nextControlLocation.Y  = parentDisplayRectangle.Y;
                nextControlLocation.X += c.Width + c.Margin.Right;
            }
            return(false);
        }
Esempio n. 4
0
        private void ControlPanelForm_Load(object sender, EventArgs e)
        {
            System.Diagnostics.Debug.Assert(MainForm != null);

            Point pt = MainForm.Location;

            pt.Offset(MainForm.Width, 0);
            Rectangle r = Screen.GetBounds(this.DesktopBounds);

            if (pt.X + Width > r.Width)
            {
                pt.X = r.Right - Width;
            }

            this.Location = pt;

            this.Height = MainForm.Height;

            MainForm.OnButtonEnable += new EventHandler <QTTagInventoryForm.OnButtonClickEventArgs>(MainForm_OnButtonEnable);

            EnableStop   = false;
            EnableSelect = _mainForm.SelectMode;
        }
Esempio n. 5
0
        private void Test_MouseHover(object sender, EventArgs e)
        {
            Point mousePt  = System.Windows.Forms.Cursor.Position;
            Point offsetPt = mousePt;


            offsetPt.Offset(this.Location.X * -1, this.Location.Y * -1);

            label1.Text = mousePt.ToString();
            label2.Text = offsetPt.ToString();

            if (this._testRect.Contains(mousePt))
            {
                label1.Text = "_testRect";
            }
            else if (IsInPolygon(_TestPoly.ToArray(), mousePt))
            {
                label1.Text = "_TestPoly";
            }
            else
            {
            }
        }
Esempio n. 6
0
        ///<summary>小地图中的移动</summary>
        private void poly_MouseMove(object sender, MouseEventArgs e)
        {
            if (e.LeftButton == MouseButtonState.Pressed)
            {
                //地图移动
                Point  curPoint = e.GetPosition(grdContent);
                Vector vec      = curPoint - prevPoint;
                if (vec.Length > 0)
                {
                    double offsetLong = vec.X / brdMap.ActualWidth * (mapdata.righttop.Longitude - mapdata.lefttop.Longitude);
                    double offsetLat  = -vec.Y / brdMap.ActualHeight * (mapdata.righttop.Latitude - mapdata.rightbottom.Latitude);

                    Point  cp = (Point)earth.camera.getScreenCenterGeo();
                    double gd = earth.camera.curCameraDistanceToGround;
                    cp.Offset(offsetLat, offsetLong);
                    earth.camera.aniLookGeo(cp.Y, cp.X, gd, 0);

                    prevPoint = curPoint;
                    refreshPoly();
                }
            }
            e.Handled = true;
        }
Esempio n. 7
0
        private Point[] GetPointAryToDown()
        {
            Point[] ptAry = new Point[4];
            ptAry[0] = new Point(0, 0);
            ptAry[1] = new Point((longer - shorter) / 2, base.Height);
            ptAry[2] = new Point(longer - (longer - shorter) / 2, base.Height);
            ptAry[3] = new Point(longer, 0);

            if (base.Width > longer)
            {
                int diffX = (base.Width - longer) / 2;
                int diffY = 0;

                for (int i = 0; i < ptAry.Length; i++)
                {
                    Point item = ptAry[i];
                    item.Offset(diffX, diffY);
                    ptAry[i] = item;
                }
            }

            return(ptAry);
        }
Esempio n. 8
0
        //creates a piece of pie diagram
        StreamGeometry drawPiece()
        {
            StreamGeometry geometry = new StreamGeometry();

            using (StreamGeometryContext ctx = geometry.Open())
            {
                geometry.FillRule = FillRule.EvenOdd;
                bool largeArc = angle > 180;

                startingPointOfArc = coordinates(pieceRotation);
                endPointOfArc      = coordinates(pieceRotation + angle);

                startingPointOfArc.Offset(60, 60);
                endPointOfArc.Offset(60, 60);

                ctx.BeginFigure(new Point(60, 60), true, true);
                ctx.LineTo(startingPointOfArc, false, true);
                ctx.ArcTo(endPointOfArc, new Size(50, 50), 0, largeArc, SweepDirection.Clockwise, false, true);
            }


            return(geometry);
        }
Esempio n. 9
0
        public void Draw(Point displayLocation)
        {
            long timeRemaining = ExpireTime - CMain.Time;

            if (DamageLabel == null)
            {
                DamageLabel = new MirLabel
                {
                    AutoSize      = true,
                    BackColour    = Color.Transparent,
                    ForeColour    = Colour,
                    OutLine       = true,
                    OutLineColour = Color.Black,
                    Text          = Text,
                    Font          = new Font(Settings.FontName, 8F, FontStyle.Bold)
                };
            }

            displayLocation.Offset((int)(15 - (Text.Length * 3)), (int)(((int)((double)timeRemaining / Factor)) - Distance) - 75 - Offset);

            DamageLabel.Location = displayLocation;
            DamageLabel.Draw();
        }
Esempio n. 10
0
        /// <summary>
        /// Set the chart transform
        /// </summary>
        /// <param name="width"></param>
        /// <param name="height"></param>
        protected void SetChartTransform(double width, double height)
        {
            Rect plotArea = ChartUtilities.GetPlotRectangle(primitiveList, 0.01f, 0.05f);

            minPoint = plotArea.Location;
            minPoint.Offset(-plotArea.Width * panZoomCalculator.Pan.X, plotArea.Height * panZoomCalculator.Pan.Y);
            minPoint.Offset(0.5 * plotArea.Width * (1 - 1 / panZoomCalculator.Zoom.X),
                            0.5 * plotArea.Height * (1 - 1 / panZoomCalculator.Zoom.Y));

            maxPoint = minPoint;
            maxPoint.Offset(plotArea.Width / panZoomCalculator.Zoom.X, plotArea.Height / panZoomCalculator.Zoom.Y);

            var plotScale = new Point();

            plotScale.X = (width / plotArea.Width) * panZoomCalculator.Zoom.X;
            plotScale.Y = (height / plotArea.Height) * panZoomCalculator.Zoom.Y;

            Matrix shapeMatrix = Matrix.Identity;

            shapeMatrix.Translate(-minPoint.X, -minPoint.Y);
            shapeMatrix.Scale(plotScale.X, plotScale.Y);
            shapeTransform.Matrix = shapeMatrix;
        }
Esempio n. 11
0
 protected override void OnMouseMove(MouseEventArgs e)
 {
     if (_isBarGotLButton)
     {
         Point p = PointToClient(MousePosition);
         p.Offset(_movePoint);
         if (p.Y >= (maximum - minimum - LargeChange) * Height / (maximum - minimum))
         {
             Value = maximum - minimum - LargeChange;
         }
         else if (p.Y <= 0)
         {
             Value = minimum;
         }
         else
         {
             //根据鼠标位置设置value值
             //p.Y / Height为当前X坐标对于总长度的所占比,再与(maximum - minimum)全长相乘得到当前value值
             Value = p.Y * (maximum - minimum) / Height;
         }
         DoScroll(ScrollEventType.EndScroll);
     }
 }
Esempio n. 12
0
            public void Update()
            {
                Win32Util.Win32API.DestroyCaret();

                if (!Win32Util.Win32API.CreateCaret(owner.Handle, IntPtr.Zero, 2, height))
                {
                    Console.WriteLine("Failed to create caret!!!");
                }

                if (visible)
                {
                    Win32Util.Win32API.ShowCaret(owner.Handle);
                }
                else
                {
                    Win32Util.Win32API.HideCaret(owner.Handle);
                }

                Point pt = location;

                pt.Offset(owner.AutoScrollPosition.X, owner.AutoScrollPosition.Y);
                Win32Util.Win32API.SetCaretPos(pt.X, pt.Y);
            }
Esempio n. 13
0
        public void Draw(int index, Point point, Color colour, bool offSet = false)
        {
            if (!CheckImage(index))
            {
                return;
            }

            MImage mi = _images[index];

            if (offSet)
            {
                point.Offset(mi.X, mi.Y);
            }

            if (point.X >= Settings.ScreenWidth || point.Y >= Settings.ScreenHeight || point.X + mi.Width < 0 || point.Y + mi.Height < 0)
            {
                return;
            }

            DXManager.Sprite.Draw(mi.Image, new Rectangle(0, 0, mi.Width, mi.Height), Vector3.Zero, new Vector3((float)point.X, (float)point.Y, 0.0F), colour);

            mi.CleanTime = CMain.Time + Settings.CleanDelay;
        }
Esempio n. 14
0
        /// <summary>
        /// When the mouse button is released, set the new image area
        /// </summary>
        /// <param name="sender">The sender of the event</param>
        /// <param name="e">The event arguments</param>
        private void pnlImage_MouseUp(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                isSelecting = false;

                // Add the point if it's a polygon
                if (shape == ImageAreaShape.Polygon)
                {
                    Point p = new Point(e.X, e.Y);
                    p.Offset(pnlImage.AutoScrollPosition.X * -1, pnlImage.AutoScrollPosition.Y * -1);

                    // Ignore it if outside the image
                    if (p.X >= 0 && p.X < imageWidth && p.Y >= 0 && p.Y < imageHeight)
                    {
                        points.Add(p);
                    }
                }

                pnlImage.Invalidate();
                pnlImage.Update();
            }
        }
Esempio n. 15
0
            private DockPane PaneAtPointWpfFloatingWindows(IDragSource source, double deltaX, double deltaY, out bool stopHitTest)
            {
                stopHitTest = false;

                FloatingWindowCollection floatingWindows = DockControl.FloatingWindows;
                Point pt = GetStartMousePosition(_wpfFloatingWindowClient);

                pt.Offset(deltaX, deltaY);
                for (int i = floatingWindows.Count - 1; i >= 0; i--)
                {
                    FloatingWindow floatingWindow = floatingWindows[i];
                    if (!floatingWindow.IsVisible)
                    {
                        continue;
                    }
                    WpfFloatingWindow window = _wpfFloatingWindowClient.ItemContainerGenerator.ContainerFromItem(floatingWindow) as WpfFloatingWindow;
                    if (window == null)
                    {
                        continue;
                    }
                    Rect windowBounds = new Rect(window.Left, window.Top, window.ActualWidth, window.ActualHeight);
                    stopHitTest = windowBounds.Contains(pt);
                    if (stopHitTest)
                    {
                        pt = _wpfFloatingWindowClient.TranslatePoint(pt, window);
                        var result = PaneFromHitTestResult(source, VisualTreeHelper.HitTest(window, pt));
                        if (result == null || !source.CanDrop(result))
                        {
                            stopHitTest = false;
                            continue;
                        }
                        return(result);
                    }
                }

                return(null);
            }
Esempio n. 16
0
		private void BuildPathsCoords(int index, int startX, int startY, params int[] waypoints)
		{
			startCoords[index] = new Point(startX, startY);
			int minX = startX, maxX = startX, minY = startY, maxY = startY;

			for (var i = 0; i < waypoints.Length; i += 2)
			{
				var curX = waypoints[i];
				if (curX < minX) minX = curX; else if (curX > maxX) maxX = curX;
				var curY = waypoints[i + 1];
				if (curY < minY) minY = curY; else if (curY > maxY) maxY = curY;
			}

			var bitmap = new BitmapBits(maxX - minX + 2, maxY - minY + 2);
			int x1 = startX - minX , y1 = startY - minY;
			var previous = new Point(x1, y1);

			for (var i = 0; i < waypoints.Length; i += 2)
			{
				int x2 = waypoints[i] - minX, y2 = waypoints[i + 1] - minY;
				bitmap.DrawLine(LevelData.ColorBlack, x1, y1 + 1, x2, y2 + 1);
				bitmap.DrawLine(LevelData.ColorBlack, x1 + 1, y1, x2 + 1, y2);
				bitmap.DrawLine(LevelData.ColorBlack, x1 + 1, y1 + 1, x2 + 1, y2 + 1);
				x1 = x2; y1 = y2;
			}

			for (var i = 0; i < waypoints.Length; i += 2)
			{
				var current = new Point(waypoints[i] - minX, waypoints[i + 1] - minY);
				bitmap.DrawLine(LevelData.ColorWhite, previous, current);
				previous = current;
			}

			previous.Offset(minX, minY);
			endCoords[index] = previous;
			paths[index] = new Sprite(bitmap, minX, minY);
		}
Esempio n. 17
0
        private void DrawScroller(DrawingContext context, Scroller tempScroller)
        {
            if (upScroller.state == ScrollerStates.None || downScroller.state == ScrollerStates.None)
            {
                return;
            }
            double width  = 20;
            double height = 10;
            Rect   rect   = new Rect();

            rect.Size = new Size(width, height);
            Point center = tempScroller.position;

            center.Offset(-width / 2, -height / 2);
            rect.Location = center;

            Brush b = Brushes.White;

            if (tempScroller.state == ScrollerStates.Hovered)
            {
                b = Brushes.Red;
            }
            else if (tempScroller.state == ScrollerStates.Edge)
            {
                b = Brushes.Blue;
            }
            else if (tempScroller.state == ScrollerStates.Normal)
            {
                b = Brushes.Green;
            }

            context.DrawRectangle(b, null, rect);

            Rect r = new Rect(tempScroller.position, new Size(1, 1));

            context.DrawRectangle(Brushes.Black, null, r);
        }
        protected override void OnPaint(PaintEventArgs e)
        {
            DrawBackground(e.Graphics);

            Point point = new Point
            {
                X = (this.Width - this.Image.Width) / 2,
                Y = (this.Height - this.Image.Height) / 2
            };

            if (this.Enabled)
            {
                if (this.drawState == ButtonDrawState.Pressed)
                {
                    point.Offset(1, 1);
                }

                if (this.image != null)
                {
                    e.Graphics.DrawImage(this.image, point);
                }

                if (this.drawState == ButtonDrawState.Focused)
                {
                    DrawFocusRectangle(e.Graphics);
                }
            }
            else
            {
                if (this.image != null)
                {
                    ControlPaint.DrawImageDisabled(e.Graphics, this.image, point.X, point.Y, this.BackColor);
                }
            }

            base.OnPaint(e);
        }
Esempio n. 19
0
        private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
        {
            if (Chatbox == null)
            {
                return;
            }

            Point selectLocation = ContainerToChatbox(e.Location);

            selectLocation.Offset(1, 0);
            selectLocation.X = Math.Min(Math.Max(selectLocation.X, 0), Chatbox.Width);
            selectLocation.Y = Math.Min(Math.Max(selectLocation.Y, 0), Chatbox.Height);

            cursorLocation.Text = $"{selectLocation.X}, {selectLocation.Y}. Line location: {SetLineRect.Y}";

            if (!SetLineMode)
            {
                if (e.Button != MouseButtons.Left)
                {
                    return;
                }

                SelectRect.Location = new Point(
                    Math.Min(SelectStartPoint.X, selectLocation.X),
                    Math.Min(SelectStartPoint.Y, selectLocation.Y));
                SelectRect.Size = new Size(
                    Math.Abs(SelectStartPoint.X - selectLocation.X),
                    Math.Abs(SelectStartPoint.Y - selectLocation.Y));

                Chat.Invalidate();
            }
            else
            {
                SetLineRect = new Rectangle(0, selectLocation.Y, Chat.Width, 1);
                Chat.Invalidate();
            }
        }
        private void SetToolTip(string text, int lineNumber)
        {
            if (toolTip == null || toolTip.IsDisposed)
            {
                toolTip = new DeclarationViewWindow(FindForm());
            }

            if (oldToolTip == text)
            {
                return;
            }

            if (text == null)
            {
                toolTip.Hide();
            }
            else
            {
                Point p  = MousePosition;
                Point cp = PointToClient(p);

                if (lineNumber >= 0)
                {
                    lineNumber = Document.GetVisibleLine(lineNumber);
                    p.Y        = (p.Y - cp.Y) + (lineNumber * TextView.FontHeight) - virtualTop.Y;
                }

                p.Offset(3, 3);
                toolTip.Owner       = FindForm();
                toolTip.Location    = p;
                toolTip.Description = text;
                toolTip.HideOnClick = true;
                toolTip.Show();
            }

            oldToolTip = text;
        }
Esempio n. 21
0
        private GraphicsPath GenerateStem(double minD, double maxD, double minA, double maxA, [Optional] Point offset)
        {
            GraphicsPath path = new GraphicsPath();

            double d = random.NextDouble() * (maxD - minD) + minD;
            double a = random.NextDouble() * (maxA - minA) + minA;

            if (offset.Equals(new Point(0, 0)))
            {
                offset = new Point(1920 / 2, 1080 / 6 * 5);
            }
            Point start = new Point(0, 0);

            start.Offset(offset);
            Point end = new Point(Convert.ToInt32(Math.Cos(a) * d), Convert.ToInt32(Math.Sin(a) * d));

            end.Offset(offset);

            Point control = end;

            control.Offset(random.Next(-50, 50), random.Next(25, 100));

            Point control1 = Point.Round(LerpPoint(start, control, 2 / 3));
            Point control2 = Point.Round(LerpPoint(control, end, 1 / 3));

            //g.DrawLine(penWhite, start, end);
            path.AddBezier(start, control1, control2, end);

            //Pen penDebug = new Pen(Color.FromArgb(0, 255, 0));
            //Size s20 = new Size(20, 20);
            //Size s10 = new Size(10, 10);
            //Size s5 = new Size(5, 5);
            //g.DrawEllipse(penDebug, new Rectangle(start - s10, s20));
            //g.DrawEllipse(penDebug, new Rectangle(control - s5, s10));
            //g.DrawEllipse(penDebug, new Rectangle(end - s10, s20));
            return(path);
        }
Esempio n. 22
0
        private void drawMstBtn_Click(object sender, EventArgs e)
        {
            Graphics G = Graphics.FromImage(drawZone.Image);

            // Drawing Vertex rectangle.
            foreach (Point p in pos.Values)
            {
                G.FillRectangle(new SolidBrush(Color.Green), new Rectangle(p, new Size(20, 20)));
            }

            foreach (Edge edge in mstG.getEdges())
            {
                Point src = pos[edge.getSrc().getName()];
                Point dst = pos[edge.getDst().getName()];
                src.Offset(10, 10);
                dst.Offset(10, 10);
                G.DrawLine(new Pen(new SolidBrush(Color.Blue), 5), src, dst);

                Point lineCenter = new Point((src.X + dst.X) / 2, (src.Y + dst.Y) / 2);
                G.DrawString(edge.getWeight().ToString(), new Font(new FontFamily("新細明體"), 8.0F), new SolidBrush(Color.Red), lineCenter);
                System.Threading.Thread.Sleep(1000);
                // Drawing Vertex rectangle.
                foreach (Point p in pos.Values)
                {
                    G.FillRectangle(new SolidBrush(Color.Green), new Rectangle(p, new Size(20, 20)));
                }
                // Drawing Vertex name.
                foreach (String name in pos.Keys)
                {
                    Point p = pos[name];
                    p.Offset(5, 5);
                    G.DrawString(name, new Font(new FontFamily("新細明體"), 8.0F), new SolidBrush(Color.White), p);
                }
                drawZone.Refresh();
            }
            drawZone.Refresh();
        }
Esempio n. 23
0
        private void SetGridUi()
        {
            int possibleButtonHeight = (this.ClientSize.Height - (5 * grid.NumberOfRows)) / grid.NumberOfColumns;
            int possibleButtonWidth  = (this.ClientSize.Width - (5 * grid.NumberOfColumns)) / grid.NumberOfRows;

            for (int i = 0; i < grid.NumberOfRows; i++)
            {
                Point newLoc = new Point(5, 5 * (i + 1) + i * possibleButtonHeight);
                for (int j = 0; j < grid.NumberOfColumns; j++)
                {
                    Button b = new Button
                    {
                        Size = new Size(possibleButtonWidth, possibleButtonHeight), Location = newLoc
                    };
                    newLoc.Offset(possibleButtonWidth + 5, 0);

                    b.Text      = grid.Values[i][j].Value.ToString();
                    b.ForeColor = Color.White;
                    b.Font      = new Font("Arial", possibleButtonHeight / 4, FontStyle.Bold);


                    if (grid.Values[i][j].Value == -1)
                    {
                        b.BackColor = (Color)Color.FromArgb(255, 255, 255, 255);
                    }
                    else if (grid.Values[i][j].Value != 0)
                    {
                        int intensity = (255 / (grid.NumberOfNonzeroPins / 2)) * grid.Values[i][j].Value;
                        b.BackColor = (Color)Color.FromArgb(255, 255 - intensity, 0, 0);
                    }

                    Controls.Add(b);
                }
            }

            BtnList = Controls.OfType <Button>().ToList();
        }
Esempio n. 24
0
        ///// <summary>
        ///// Notifies the child shapes that their parent will be moved. Moves all children according to the parent's movement.
        ///// </summary>
        //public virtual void NotifyParentMoving() {
        //   // nothing to do
        //}


        /// <summary>
        /// Notifies the child shapes that their parent has been moved. Moves all children according to the parent's movement.
        /// </summary>
        /// <returns>
        /// True if all child shapes have moved in the desired way.
        /// False if the child shapes cannot move as desired due to restrictions (such as connections).
        /// </returns>
        public virtual bool NotifyParentMoved(int deltaX, int deltaY)
        {
            if (shapes.Count == 0)
            {
                return(true);
            }
            else
            {
                bool result = true;
                try {
                    SuspendUpdate();
                    // move child shapes with parent
                    for (int i = 0; i < shapes.Count; ++i)
                    {
                        // move shape
                        if (!shapes[i].MoveBy(deltaX, deltaY))
                        {
                            result = false;
                        }
                        // Update centerPoint:
                        // Due to the fact that Point is a value Type, we have to overwrite the Point with a new Point.
                        Point shapeCenter = shapePositions[shapes[i]];
                        shapeCenter.Offset(deltaX, deltaY);
                        shapePositions[shapes[i]] = shapeCenter;
                    }
                    if (Geometry.IsValid(boundingRectangleTight))
                    {
                        boundingRectangleTight.Offset(deltaX, deltaY);
                    }
                    if (Geometry.IsValid(boundingRectangleLoose))
                    {
                        boundingRectangleLoose.Offset(deltaX, deltaY);
                    }
                } finally { ResumeUpdate(); }
                return(result);
            }
        }
Esempio n. 25
0
        private void Form1_MouseDown(object sender, MouseEventArgs e)
        {
            //     Positive(director.BLUE);
            // director x = (director)nUD.Value;
            color x = color.RED;

            Positive(x);

            this.Controls.Add(new Piece(e.X, e.Y));



            Point p  = new Point(100, 100);
            Point p1 = new Point(100, 201);



            p.Offset(10, 101);
            if (p.X.Equals(p1.X) == true)
            {
                textBox1.Text += "二者X相同\r\n";
            }
            else
            {
                textBox1.Text += "二者X不同\r\n";
            }

            if (p.Y.Equals(p1.Y) == true)
            {
                textBox1.Text += "二者Y相同\r\n";
            }
            else
            {
                textBox1.Text += "二者Y不同\r\n";
            }
            textBox1.Text += $"點擊位置為 X={e.X},Y={e.Y}\r\n";
        }
        void IResizeController.Resize(Point posCurrent)
        {
            RectangleElement corner = selectionCorner[0];
            Point            loc;

            Point dragPointEl = posCurrent;

            dragPointEl.Offset(dragOffset.X, dragOffset.Y);
            if (dragPointEl.X < 0)
            {
                dragPointEl.X = 0;
            }
            if (dragPointEl.Y < 0)
            {
                dragPointEl.Y = 0;
            }

            if (el.orientation == Orientation.Horizontal)
            {
                corner.Location    = new Point(dragPointEl.X, corner.Location.Y);
                loc                = new Point(corner.Location.X + corner.Size.Width / 2, corner.Location.Y + corner.Size.Height / 2);
                el.lines[1].Point1 = new Point(loc.X, el.lines[1].Point1.Y);
                el.lines[1].Point2 = new Point(loc.X, el.lines[1].Point2.Y);
            }
            else
            {
                corner.Location    = new Point(corner.Location.X, dragPointEl.Y);
                loc                = new Point(corner.Location.X + corner.Size.Width / 2, corner.Location.Y + corner.Size.Height / 2);
                el.lines[1].Point1 = new Point(el.lines[1].Point1.X, loc.Y);
                el.lines[1].Point2 = new Point(el.lines[1].Point2.X, loc.Y);
            }

            el.lines[0].Point2 = el.lines[1].Point1;
            el.lines[2].Point1 = el.lines[1].Point2;

            el.NeedCalcLink = true;
        }
Esempio n. 27
0
 private void ShowDropDown()
 {
     if (base.Parent != null)
     {
         Point location = new Point(base.Left, base.Bottom - 1);
         Point point    = base.Parent.PointToScreen(base.Parent.Location);
         Point point2   = base.TopLevelControl.PointToScreen(base.Parent.Location);
         location.Offset(point.X - point2.X, point.Y - point2.Y);
         if (location.Y + m_TreeView.Height > base.TopLevelControl.ClientRectangle.Height)
         {
             location.Y -= base.Height + m_TreeView.Height;
             if (location.Y < 0)
             {
                 location.Y = base.TopLevelControl.ClientRectangle.Height - m_TreeView.Height;
             }
         }
         if (location.X + m_TreeView.Width > base.TopLevelControl.ClientRectangle.Width)
         {
             location.X = base.TopLevelControl.ClientRectangle.Width - m_TreeView.Width;
         }
         m_TreeView.Location = location;
         m_TreeView.Visible  = true;
         m_TreeView.Parent   = base.TopLevelControl;
         m_TreeView.BringToFront();
         b_Dropdown = true;
         if (this.DropDown != null)
         {
             this.DropDown(this, EventArgs.Empty);
         }
         m_TreeView.Focus();
         TreeNode selectedNode = m_TreeView.SelectedNode;
         if (selectedNode != null)
         {
             m_TextBox.Text = selectedNode.Text;
         }
     }
 }
Esempio n. 28
0
        protected override void OnLayout(LayoutEventArgs levent)
        {
            if (Appearance != DockPane.AppearanceStyle.Document)
            {
                base.OnLayout(levent);
                return;
            }

            Rectangle rectTabStrip = TabStripRectangle;

            // Set position and size of the buttons
            int buttonWidth  = ButtonClose.Image.Width;
            int buttonHeight = ButtonClose.Image.Height;
            int height       = rectTabStrip.Height - DocumentButtonGapTop - DocumentButtonGapBottom;

            if (buttonHeight < height)
            {
                buttonWidth  = buttonWidth * (height / buttonHeight);
                buttonHeight = height;
            }
            Size buttonSize = new Size(buttonWidth, buttonHeight);

            int x = rectTabStrip.X + rectTabStrip.Width - DocumentTabGapLeft
                    - DocumentButtonGapRight - buttonWidth;
            int y = rectTabStrip.Y + DocumentButtonGapTop;

            // HACK - Mika
            Point point = new Point(x - 1, y);

            ButtonClose.Bounds = DrawHelper.RtlTransform(this, new Rectangle(point, buttonSize));
            point.Offset(-(DocumentButtonGapBetween + buttonWidth), 0);
            ButtonWindowList.Bounds = DrawHelper.RtlTransform(this, new Rectangle(point, buttonSize));

            OnRefreshChanges();

            base.OnLayout(levent);
        }
Esempio n. 29
0
        /// <summary>
        /// 移動
        /// </summary>
        /// <param name="selectedOnly">選択フラグが立っているものだけ移動する場合はtrue</param>
        /// <param name="offset">移動量</param>
        public override void Move(bool selectedOnly, Point offset, Point ptAbs, bool moveSingle)
        {
            //中心座標が選択されているとき、両端点が選択されているときは全体が選択されているとみなす
            if (!selectedOnly || selectFlag[0] || (selectFlag[1] && selectFlag[2]))
            {
                Point newPos = posArray[0];
                newPos.Offset(offset);
                SetPos(newPos, 0);
                return;
            }

            int index;

            if (selectFlag[1])
            {
                index = 1;
            }
            else if (selectFlag[2])
            {
                index = 2;
            }
            else
            {
                return;
            }
            if (moveSingle)
            {
                SetPos(ptAbs, index);
            }
            else
            {
                Point newPos = posArray[0];
                newPos.Offset(offset);
                SetPos(newPos, 0);
                return;
            }
        }
Esempio n. 30
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);
            if (RS == null)
            {
                return;
            }
            Point cell;

            if (MouseToCell(e.Location, out cell) && (RS.Players.Count > cell.Y) && (RS.Competitions.Count > cell.X) && (cell.X - ViewColFrom < VisibleColCount))
            {
                Point loc = Rect_Results.Location;
                loc.Offset((cell.X - ViewColFrom + 1) * ColWidth_C - ColWidth_C / 2, (cell.Y - ViewRowFrom) * Height_Row + 2 - pnlInfo.Height);
                //lblCellInfo.Text = String.Format("{0}x{1}", cell.X, cell.Y);
                pnlInfo.Location = loc;
                int             playerId = FPlayers[cell.Y].Id;
                CompetitionInfo comp     = RS.Competitions[cell.X];
                if (comp.Results.ContainsKey(playerId))
                {
                    PlayersCompetitionResult res = comp.Results[playerId];
                    lblInfoRatingBegin.Text = res.RatingBegin.ToString();
                    lblInfoDelta.Text       = res.Delta.ToString();
                    lblInfoPenalty.Text     = (res.Penalty == 0) ? "-" : res.Penalty.ToString();
                    lblInfoRating.Text      = (res.RatingBegin + res.Delta).ToString();
                    pnlInfo.Visible         = true;
                    pnlInfo.BringToFront();
                }
                else
                {
                    pnlInfo.Visible = false;
                }
            }
            else
            {
                pnlInfo.Visible = false;
            }
        }
Esempio n. 31
0
        public void OffsetTest(int x, int y)
        {
            Point p1 = new Point(x, y);
            Point p2 = new Point(y, x);

            p1.Offset(p2);

            Assert.Equal(p2.X + p2.Y, p1.X);
            Assert.Equal(p1.X, p1.Y);

            p2.Offset(x, y);
            Assert.Equal(p1, p2);
        }
            private bool HitImageTestAt(Point p, ListViewItem item)
            {
                Rectangle rcItem = item.GetBounds(ItemBoundsPortion.Entire);
                GraphicsUnit units = GraphicsUnit.Point;
                if (item.ImageList != null)
                {
                    Image img = item.ImageList.Images[0];
                    RectangleF rcImageF = img.GetBounds(ref units);
                    Rectangle rcImage = Rectangle.Round(rcImageF);

                    rcImage.Width += item.IndentCount + item.Position.X;
                    p.Offset(rcItem.Left, -rcItem.Top);

                    if (rcImage.Contains(p))
                    {
                        return true;
                    }
                    else
                    {
                        return false;
                    }
                }
                return false;
            }
Esempio n. 33
0
 public static Point PointMove(Point p, MirDirection d, int i)
 {
     switch (d)
     {
         case MirDirection.Up:
             p.Offset(0, -i);
             break;
         case MirDirection.UpRight:
             p.Offset(i, -i);
             break;
         case MirDirection.Right:
             p.Offset(i, 0);
             break;
         case MirDirection.DownRight:
             p.Offset(i, i);
             break;
         case MirDirection.Down:
             p.Offset(0, i);
             break;
         case MirDirection.DownLeft:
             p.Offset(-i, i);
             break;
         case MirDirection.Left:
             p.Offset(-i, 0);
             break;
         case MirDirection.UpLeft:
             p.Offset(-i, -i);
             break;
     }
     return p;
 }
Esempio n. 34
0
        /// <summary>
        ///     Checks where the click was in the NC area and starts move or resize operation
        /// </summary>
        /// <param name="iHitTest"></param>
        /// <param name="point"></param>
        /// <returns></returns>
        private bool OnNCLButtonDown(int iHitTest, Point point)
        {
            _offsetPoint = point;

            switch (iHitTest)
            {
                case UnsafeNativeMethods.HT.HTCAPTION:
                    {
                        // request for move
                        if (StickOnMove)
                        {
                            var pointInApp = _originalForm.PointToClient(Cursor.Position);
                            _offsetPoint.Offset(pointInApp.X, pointInApp.Y);
                            StartMove();
                            return true;
                        }
                        return false; // leave default processing
                    }

                // requests for resize
                case UnsafeNativeMethods.HT.HTTOPLEFT:
                    return StartResize(ResizeDir.Top | ResizeDir.Left);
                case UnsafeNativeMethods.HT.HTTOP:
                    return StartResize(ResizeDir.Top);
                case UnsafeNativeMethods.HT.HTTOPRIGHT:
                    return StartResize(ResizeDir.Top | ResizeDir.Right);
                case UnsafeNativeMethods.HT.HTRIGHT:
                    return StartResize(ResizeDir.Right);
                case UnsafeNativeMethods.HT.HTBOTTOMRIGHT:
                    return StartResize(ResizeDir.Bottom | ResizeDir.Right);
                case UnsafeNativeMethods.HT.HTBOTTOM:
                    return StartResize(ResizeDir.Bottom);
                case UnsafeNativeMethods.HT.HTBOTTOMLEFT:
                    return StartResize(ResizeDir.Bottom | ResizeDir.Left);
                case UnsafeNativeMethods.HT.HTLEFT:
                    return StartResize(ResizeDir.Left);
            }

            return false;
        }
Esempio n. 35
0
        private void Move(Point p)
        {
            p = _originalForm.PointToScreen(p);
            var activeScr = Screen.FromPoint(p); // get the screen from the point !!

            if (!activeScr.WorkingArea.Contains(p))
            {
                p.X = NormalizeInside(p.X, activeScr.WorkingArea.Left, activeScr.WorkingArea.Right);
                p.Y = NormalizeInside(p.Y, activeScr.WorkingArea.Top, activeScr.WorkingArea.Bottom);
            }

            p.Offset(-_offsetPoint.X, -_offsetPoint.Y);

            // p is the exact location of the frame - so we can play with it
            // to detect the new position acording to different bounds
            _formRect.Location = p; // this is the new positon of the form

            _formOffsetPoint.X = _stickGap + 1; // (more than) maximum gaps
            _formOffsetPoint.Y = _stickGap + 1;

            if (StickToScreen)
                Move_Stick(activeScr.WorkingArea, false);

            // Now try to snap to other windows
            if (StickToOther)
            {
                foreach (Form sw in GlobalStickyWindows)
                {
                    if (sw != _originalForm)
                        Move_Stick(sw.Bounds, true);
                }
            }

            if (_formOffsetPoint.X == _stickGap + 1)
                _formOffsetPoint.X = 0;
            if (_formOffsetPoint.Y == _stickGap + 1)
                _formOffsetPoint.Y = 0;

            _formRect.Offset(_formOffsetPoint);

            _originalForm.Bounds = _formRect;
        }
        void SetupHexagonalGrid()
        {
            // Make cell regions: we assume cells have only 1 region but that can change in the future
            int l = _numCells;
            int qx, qy;
            int q = (int)(Math.Sqrt (l));
            q = q * 12 / 13;
            if (q<1) q= 1;
            qx=qy=q;
            int qx2 = qx * 4 / 3;

            double stepX = (transform.localScale.y / transform.localScale.x) / qx;
            double stepY = (transform.localScale.x / transform.localScale.y) / qy;

            double halfStepX = stepX*0.5;
            double halfStepY = stepY*0.5;

            Segment [,,] sides = new Segment[qx2,qy,6]; // 0 = left-up, 1 = top, 2 = right-up, 3 = right-down, 4 = down, 5 = left-down
            int c = -1;
            int subdivisions = goodGridCurvature > 0 ? 3: 1;
            for (int j=0;j<qy;j++) {
                for (int k=0;k<qx2;k++) {
                    Point center = new Point((double)k/qx-0.5+halfStepX,(double)j/qy-0.5+halfStepY);
                    center.x -= k *  halfStepX/2;
                    Cell cell = new Cell( (++c).ToString(), new Vector2((float)center.x, (float)center.y));

                    double offsetY = (k % 2==0) ? 0: -halfStepY;

                    Segment leftUp =  (k>0 && offsetY<0) ? sides[k-1, j, 3]: new Segment(center.Offset(-halfStepX, offsetY), center.Offset(-halfStepX/2, halfStepY + offsetY), k==0 || (j==qy-1 && offsetY==0));
                    sides[k, j, 0] = leftUp;

                    Segment top = new Segment(center.Offset(-halfStepX/2, halfStepY + offsetY), center.Offset(halfStepX/2, halfStepY + offsetY), j==qy-1);
                    sides[k, j, 1] = top;

                    Segment rightUp = new Segment(center.Offset(halfStepX/2, halfStepY + offsetY), center.Offset(halfStepX, offsetY), k==qx2-1 || (j==qy-1 && offsetY==0));
                    sides[k, j, 2] = rightUp;

                    Segment rightDown = (j > 0 && k<qx2-1 && offsetY<0) ? sides[k+1,j-1,0]: new Segment(center.Offset(halfStepX, offsetY), center.Offset(halfStepX/2, -halfStepY + offsetY), (j==0 && offsetY<0)|| k==qx2-1);
                    sides[k, j, 3] = rightDown;

                    Segment bottom = j>0 ? sides[k, j-1, 1] : new Segment(center.Offset(halfStepX/2, -halfStepY + offsetY), center.Offset(-halfStepX/2, -halfStepY +offsetY), true);
                    sides[k, j, 4] = bottom;

                    Segment leftDown;
                    if (offsetY<0 && j>0) {
                        leftDown = sides[k-1, j-1, 2];
                    } else if (offsetY==0 && k>0) {
                        leftDown = sides[k-1, j, 2];
                    } else {
                        leftDown = new Segment(center.Offset(-halfStepX/2, -halfStepY+offsetY), center.Offset(-halfStepX, offsetY), true);
                    }
                    sides[k, j, 5] = leftDown;

                    if (j==0) {
            //						leftDown.CropBottom();
            //						bottom.CropBottom();
            //						rightDown.CropBottom();
                    }
                    if (k==qx2-1) {
                        top.CropRight();
                        rightUp.CropRight();
                        rightDown.CropRight();
                        bottom.CropRight();
                    }

                    Region cr = new Region (cell);
                    if (subdivisions>1) {
                        if (!top.deleted) cr.segments.AddRange (top.Subdivide(subdivisions, _gridCurvature));
                        if (!rightUp.deleted) cr.segments.AddRange (rightUp.Subdivide(subdivisions, _gridCurvature));
                        if (!rightDown.deleted) cr.segments.AddRange (rightDown.Subdivide(subdivisions, _gridCurvature));
                        if (!bottom.deleted) cr.segments.AddRange (bottom.Subdivide(subdivisions, _gridCurvature));
                        if (!leftDown.deleted) cr.segments.AddRange (leftDown.Subdivide(subdivisions, _gridCurvature));
                        if (!leftUp.deleted) cr.segments.AddRange (leftUp.Subdivide(subdivisions, _gridCurvature));
                    } else {
                        if (!top.deleted) cr.segments.Add (top);
                        if (!rightUp.deleted) cr.segments.Add (rightUp);
                        if (!rightDown.deleted) cr.segments.Add (rightDown);
                        if (!bottom.deleted) cr.segments.Add (bottom);
                        if (!leftDown.deleted) cr.segments.Add (leftDown);
                        if (!leftUp.deleted) cr.segments.Add (leftUp);
                    }
                    Connector connector = new Connector();
                    connector.AddRange(cr.segments);
                    cr.polygon = connector.ToPolygon(); // FromLargestLineStrip();
                    if (cr.polygon!=null) {
                        cell.region = cr;
                        cells.Add (cell);
                    }
                }
            }
        }
        void SetupBoxGrid(bool strictQuads)
        {
            // Make cell regions: we assume cells have only 1 region but that can change in the future
            int l = _numCells;
            int qx, qy;
            int q = (int)(Math.Sqrt (l));
            if (strictQuads) {
                qx=qy=q;
            } else {
                qx=l;
                qy=1;
                if (q<1) q=1;
                if ( (int)(q*q) != l) { // not squared
                    if (!GetTwoFactors(l, out qx, out qy)) {
                        // if number > 10 and it's prime, reduce by one so we can avoid ugly accordian grids
                        if (l>10) GetTwoFactors(l-1, out qx, out qy);
                    }
                } else {
                    qx = qy = q;
                }
            }
            double stepX = (transform.localScale.y / transform.localScale.x) / qx;
            double stepY = (transform.localScale.x / transform.localScale.y) / qy;

            double halfStepX = stepX*0.5;
            double halfStepY = stepY*0.5;

            Segment [,,] sides = new Segment[qx,qy,4]; // 0 = left, 1 = top, 2 = right, 3 = bottom
            int c = -1;
            int subdivisions = goodGridCurvature > 0 ? 3: 1;
            for (int k=0;k<qx;k++) {
                for (int j=0;j<qy;j++) {
                    Point center = new Point((double)k/qx-0.5+halfStepX,(double)j/qy-0.5+halfStepY);
                    Cell cell = new Cell( (++c).ToString(), new Vector2((float)center.x, (float)center.y));

                    Segment left = k>0 ? sides[k-1, j, 2] : new Segment(center.Offset(-halfStepX, -halfStepY), center.Offset(-halfStepX, halfStepY), true);
                    sides[k, j, 0] = left;

                    Segment top = new Segment(center.Offset(-halfStepX, halfStepY), center.Offset(halfStepX, halfStepY), j==qy-1);
                    sides[k, j, 1] = top;

                    Segment right = new Segment(center.Offset(halfStepX, halfStepY), center.Offset(halfStepX, -halfStepY), k==qx-1);
                    sides[k, j, 2] = right;

                    Segment bottom = j>0 ? sides[k, j-1, 1] : new Segment(center.Offset(halfStepX, -halfStepY), center.Offset(-halfStepX, -halfStepY), true);
                    sides[k, j, 3] = bottom;

                    Region cr = new Region (cell);
                    if (subdivisions>1) {
                        cr.segments.AddRange (top.Subdivide(subdivisions, _gridCurvature));
                        cr.segments.AddRange (right.Subdivide(subdivisions, _gridCurvature));
                        cr.segments.AddRange (bottom.Subdivide(subdivisions, _gridCurvature));
                        cr.segments.AddRange (left.Subdivide(subdivisions, _gridCurvature));
                    } else {
                        cr.segments.Add (top);
                        cr.segments.Add (right);
                        cr.segments.Add (bottom);
                        cr.segments.Add (left);
                    }
                    Connector connector = new Connector();
                    connector.AddRange(cr.segments);
                    cr.polygon = connector.ToPolygon(); // FromLargestLineStrip();
                    if (cr.polygon!=null) {
                        cell.region = cr;
                        cells.Add (cell);
                    }
                }
            }
        }
                protected override void OnLayout(LayoutEventArgs levent)
                {
                    // set the size and location for close and auto-hide buttons
                    Rectangle rectCaption = ClientRectangle;
                    int buttonWidth = ImageCloseEnabled.Width;
                    int buttonHeight = ImageCloseEnabled.Height;
                    int height = rectCaption.Height - ButtonGapTop - ButtonGapBottom;
                    if (buttonHeight < height)
                    {
                        buttonWidth = buttonWidth * (height / buttonHeight);
                        buttonHeight = height;
                    }

                    m_buttonClose.SuspendLayout();
                    m_buttonAutoHide.SuspendLayout();
                    m_buttonOptions.SuspendLayout();

                    Size buttonSize = new Size(buttonWidth, buttonHeight);
                    m_buttonAutoHide.Size = buttonSize;
                    m_buttonClose.Size = buttonSize;
                    m_buttonOptions.Size = buttonSize;

                    int x = rectCaption.X + rectCaption.Width - 1 - ButtonGapRight - m_buttonClose.Width;
                    int y = rectCaption.Y + ButtonGapTop;
                    Point point = new Point(x, y);
                    m_buttonClose.Location = point;
                    point.Offset(- (m_buttonAutoHide.Width + ButtonGapBetween), 0);
                    m_buttonAutoHide.Location = point;
                    point.Offset(- (m_buttonOptions.Width + ButtonGapBetween), 0);
                    m_buttonOptions.Location = point;

                    m_buttonClose.ResumeLayout();
                    m_buttonAutoHide.ResumeLayout();
                    m_buttonOptions.ResumeLayout();
                    base.OnLayout(levent);
                }
Esempio n. 39
0
        void UpdateMousePosition()
        {
            mouse_current = System.Windows.Forms.Cursor.Position;
            if (FreeMouse)
            {
                //System.Windows.Forms.Cursor.Hide();
                mouse_current.Offset(-X, -Y);
                mouse_current.Offset(0, -20);
                //System.Windows.Forms.Cursor.Show();
            }
            if (!Focused)
            {
                return;
            }
            mouseleftclick = (!wasmouseleft) && Mouse[OpenTK.Input.MouseButton.Left];
            mouserightclick = (!wasmouseright) && Mouse[OpenTK.Input.MouseButton.Right];
            mouseleftdeclick = wasmouseleft && (!Mouse[OpenTK.Input.MouseButton.Left]);
            mouserightdeclick = wasmouseright && (!Mouse[OpenTK.Input.MouseButton.Right]);
            wasmouseleft = Mouse[OpenTK.Input.MouseButton.Left];
            wasmouseright = Mouse[OpenTK.Input.MouseButton.Right];
            if (freemousejustdisabled)
            {
                mouse_previous = mouse_current;
                freemousejustdisabled = false;
            }
            if (!FreeMouse)
            {
                int centerx = Bounds.Left + (Bounds.Width / 2);
                int centery = Bounds.Top + (Bounds.Height / 2);

                mouse_delta = new Point(mouse_current.X - mouse_previous.X,
                    mouse_current.Y - mouse_previous.Y);
                mouse_previous = mouse_current;

                if ((Math.Abs(System.Windows.Forms.Cursor.Position.X - centerx) > 100)
                    || (Math.Abs(System.Windows.Forms.Cursor.Position.Y - centery) > 100))
                {
                    System.Windows.Forms.Cursor.Position =
                        new Point(centerx, centery);
                    mouse_previous = new Point(centerx, centery);
                }
            }
        }
            protected override void WndProc(ref Message m)
            {
                switch (m.Msg)
                {
                    case WM_LButtonDown:
                        if (GetValueRec().IsVisible(new Point(m.LParam.ToInt32())))
                        {
                            dragin = true;
                            lpoint = m.LParam.ToInt32();
                            Point tp = new Point(lpoint);
                            tp.Offset(-3, -3);
                            europeanswallow = new Rectangle(tp, new Size(6, 6));
                            ltime = DateTime.Now.Ticks;
                            Cursor.Current = Cursors.Hand;
                            cans = true;
                        }
                        break;
                    case WM_MouseMove:
                        if (dragin)
                        {

                            Point p = new Point(m.LParam.ToInt32());
                            if (cans)
                            {
                                if (europeanswallow.Contains(p))
                                {
                                    double f = DateTime.Now.Subtract(new DateTime(ltime)).TotalSeconds;
                                    if (f >= 1.5)
                                        cans = false;
                                    else if (f >= 0.5)
                                    {
                                        dragin = false;
                                        Cursor.Current = Cursors.SizeAll;
                                        break;
                                    }
                                }
                                else
                                    cans = false;
                            }

                            float v = (float)(((AnalogMeter.PointToAngle(p)) / 180f) * (1023));
                            vm.Value = Math.Max(0, Math.Min(1023, v));
                            Cursor.Current = Cursors.Hand;
                            return;
                        }
                        else if (GetValueRec().IsVisible(new Point(m.LParam.ToInt32())))
                        {
                            inadorn = true;
                            Cursor.Current = Cursors.Hand;
                        }
                        else
                            inadorn = false;

                        break;
                    case WM_LButtonUp:
                        if (dragin)
                            dragin = false;
                        break;
                }
                base.WndProc(ref m);
            }
Esempio n. 41
0
 public static Point Right(Point p, MirDirection d)
 {
     switch (d)
     {
         case MirDirection.Up:
             p.Offset(1, 0);
             break;
         case MirDirection.UpRight:
             p.Offset(1, 1);
             break;
         case MirDirection.Right:
             p.Offset(0, 1);
             break;
         case MirDirection.DownRight:
             p.Offset(-1, 1);
             break;
         case MirDirection.Down:
             p.Offset(-1, 0);
             break;
         case MirDirection.DownLeft:
             p.Offset(-1,-1);
             break;
         case MirDirection.Left:
             p.Offset(0, -1);
             break;
         case MirDirection.UpLeft:
             p.Offset(1, -1);
             break;
     }
     return p;
 }
Esempio n. 42
0
 public static Point OffsetPolar(Point o, double th, double dist)
 {
     int dx = MathEx.Round(dist*Math.Cos(th));
     int dy = MathEx.Round(dist*Math.Sin(th));
     o.Offset(dx,dy);
     return o;
 }