示例#1
0
        private void updateSize()
        {
            try
            {
                PointAPI p = new PointAPI();
                GetCursorPos(out p);

                if (resizeRight)
                {
                    this.Width = this.resizeSize.Width - (resizePoint.X - p.X);
                }

                if (resizeDown)
                {
                    this.Height = resizeSize.Height - (resizePoint.Y - p.Y);
                }

                if (resizeLeft)
                {
                    this.Width = resizeSize.Width + (resizePoint.X - p.X);
                    this.Left  = resizeWindowPoint.X - (resizePoint.X - p.X);
                }

                if (resizeUp)
                {
                    this.Height = resizeSize.Height + (resizePoint.Y - p.Y);
                    this.Top    = resizeWindowPoint.Y - (resizePoint.Y - p.Y);
                }
            }
            catch { }
        }
        private void updateSize()
        {
            PointAPI p = new PointAPI();

            GetCursorPos(out p);

            try
            {
                if (resizeRight)
                {
                    target.Width = this.resizeSize.Width - (resizePoint.X - p.X);
                }

                if (resizeDown)
                {
                    target.Height = resizeSize.Height - (resizePoint.Y - p.Y);
                }

                if (resizeLeft)
                {
                    target.Width = resizeSize.Width + (resizePoint.X - p.X);
                    target.Left  = resizeWindowPoint.X - (resizePoint.X - p.X);
                }

                if (resizeUp)
                {
                    target.Height = resizeSize.Height + (resizePoint.Y - p.Y);
                    target.Top    = resizeWindowPoint.Y - (resizePoint.Y - p.Y);
                }
            }
            catch (Exception ex)
            { }
        }
        private void updateSize()
        {
            PointAPI p = new PointAPI();

            GetCursorPos(out p);

            if (resizeRight)
            {
                target.Width = Math.Max(0, this.resizeSize.Width - (resizePoint.X - p.X));
            }

            if (resizeDown)
            {
                target.Height = Math.Max(0, resizeSize.Height - (resizePoint.Y - p.Y));
            }

            if (resizeLeft)
            {
                target.Width = Math.Max(0, resizeSize.Width + (resizePoint.X - p.X));
                target.Left  = Math.Max(0, resizeWindowPoint.X - (resizePoint.X - p.X));
            }

            if (resizeUp)
            {
                target.Height = Math.Max(0, resizeSize.Height + (resizePoint.Y - p.Y));
                target.Top    = Math.Max(0, resizeWindowPoint.Y - (resizePoint.Y - p.Y));
            }
        }
示例#4
0
        private void UpdateSize()
        {
            PointAPI p = new PointAPI();

            GetCursorPos(out p);

            if (resizeRight)
            {
                this.AssociatedObject.Width = Math.Abs(this.resizeSize.Width - (resizePoint.X - p.X)) + 8;
            }

            if (resizeDown)
            {
                this.AssociatedObject.Height = Math.Abs(resizeSize.Height - (resizePoint.Y - p.Y)) + 8;
            }

            if (resizeLeft)
            {
                this.AssociatedObject.Width = Math.Abs(resizeSize.Width + (resizePoint.X - p.X)) + 8;
                this.AssociatedObject.Left  = resizeWindowPoint.X - (resizePoint.X - p.X);
            }

            if (resizeUp)
            {
                this.AssociatedObject.Height = Math.Abs(resizeSize.Height + (resizePoint.Y - p.Y)) + 8;
                this.AssociatedObject.Top    = resizeWindowPoint.Y - (resizePoint.Y - p.Y);
            }
        }
示例#5
0
        private void updateSize()
        {
            PointAPI p = new PointAPI();

            GetCursorPos(out p);

            if (resizeRight)
            {
                double width = this.resizeSize.Width - (resizePoint.X - p.X);
                if (target.MinWidth != 0)
                {
                    if (width > 0 && (target.MinWidth + 1) <= width)
                    {
                        target.Width = width;
                    }
                }
                else if (width > 0)
                {
                    target.Width = width;
                }
            }

            if (resizeDown)
            {
                double height = resizeSize.Height - (resizePoint.Y - p.Y);

                if (target.MinHeight != 0)
                {
                    if (height > 0 && (target.MinHeight + 1) <= height)
                    {
                        target.Height = height;
                    }
                }
                else if (height > 0)
                {
                    target.Height = height;
                }
            }

            if (resizeLeft)
            {
                target.Width = resizeSize.Width + (resizePoint.X - p.X);
                double left = resizeWindowPoint.X - (resizePoint.X - p.X);
                if (left > 0)
                {
                    target.Left = left;
                }
            }

            if (resizeUp)
            {
                target.Height = resizeSize.Height + (resizePoint.Y - p.Y);
                double top = resizeWindowPoint.Y - (resizePoint.Y - p.Y);
                if (top > 0)
                {
                    target.Top = top;
                }
            }
        }
示例#6
0
        public void StickToCursor()
        {
            var pos = new PointAPI();

            GetCursorPos(out pos);
            _window.Left = pos.X - _window.Width / 2;
            _window.Top  = pos.Y - 5;
        }
示例#7
0
        private void Server_WaitingForPlayers()
        {
            _spawnPointFile = PointAPI.GetPointList(SpawnPointFIleName);
            _useZombies     = LoadedZombieSpawns.Count > 0;

            if (!_useZombies)
            {
                Log.Warn("There are no zombie spawn points.");
            }
        }
示例#8
0
        /* La string argument serve per la presenza di un eventuale DELTA in causa di presenza d'evento MOUSE WHEEL */
        private void doActionMouse(uint p, int delta)
        {
            PointAPI point = new PointAPI();

            GetCursorPos(out point);
            int X = point.X;
            int Y = point.Y;

            mouse_event(p, (uint)X, (uint)Y, delta, 0);
        }
示例#9
0
        private void updateSize()
        {
            PointAPI p = new PointAPI();

            GetCursorPos(out p);
            _window.SizeToContent = SizeToContent.Manual;
            var deltaX = resizePoint.X - p.X;
            var deltaY = resizePoint.Y - p.Y;

            if (resizeRight)
            {
                _window.Width = Math.Max(0, this.resizeSize.Width - deltaX);
            }

            if (resizeDown)
            {
                _window.Height = Math.Max(0, resizeSize.Height - deltaY);
            }

            if (resizeLeft)
            {
                var dw     = Math.Max(_window.MinWidth, resizeSize.Width + deltaX);
                var shiftX = dw - resizeSize.Width;
                //_window.Left = Math.Max(0, resizeWindowPoint.X  - shiftX);
                //_window.Width = dw;
                //_window.Left = resizeWindowPoint.X - shiftX;
                var     hwndSource        = PresentationSource.FromVisual(_window) as HwndSource;
                var     source            = PresentationSource.FromVisual(_window);
                Matrix  transformToDevice = source.CompositionTarget.TransformToDevice;
                Point[] point             = new Point[] { new Point(resizeWindowPoint.X - shiftX, _window.Top), new Point(dw, _window.Height) };
                transformToDevice.Transform(point);
                SetWindowPos(hwndSource.Handle, IntPtr.Zero, Convert.ToInt32(point[0].X), Convert.ToInt32(point[0].Y), Convert.ToInt32(point[1].X), Convert.ToInt32(point[1].Y), (uint)SWP.SHOWWINDOW);
            }

            if (resizeUp)
            {
                var dh     = Math.Max(_window.MinHeight, resizeSize.Height + deltaY);
                var shiftY = dh - resizeSize.Height;
                //_window.Top = Math.Max(0, resizeWindowPoint.Y - shiftY);
                _window.Height = dh;
                _window.Top    = resizeWindowPoint.Y - shiftY;
            }
        }
        private void updateSize()
        {
            PointAPI p = new PointAPI();

            GetCursorPos(out p);
            double preWidth = target.Width, preHeight = target.Height;

            if (resizeRight)
            {
                target.Width = this.resizeSize.Width - (resizePoint.X - p.X);
            }

            if (resizeDown)
            {
                target.Height = resizeSize.Height - (resizePoint.Y - p.Y);
            }

            if (resizeLeft)
            {
                target.Width  = resizeSize.Width + (resizePoint.X - p.X);
                target.Margin = new Thickness(resizeWindowPoint.X - (resizePoint.X - p.X), target.Margin.Top, target.Margin.Right, target.Margin.Bottom);
            }
            if (resizeUp)
            {
                target.Height = resizeSize.Height + (resizePoint.Y - p.Y);
                target.Margin = new Thickness(target.Margin.Left, resizeWindowPoint.Y - (resizePoint.Y - p.Y), target.Margin.Right, target.Margin.Bottom);
            }
            target.Width  = target.Width > widthMax ? widthMax : target.Width;
            target.Width  = target.Width < widthMin ? widthMin : target.Width;
            target.Height = target.Height > heightMax ? heightMax : target.Height;
            target.Height = target.Height < heightMin ? heightMin : target.Height;
            if (preWidth != target.Width || preHeight != target.Height)
            {
                ((KeyFrameAnnotation)target).WidthOrHeightChanged();
            }
        }
        private void updateSize()
        {
            PointAPI currentMousePoint = new PointAPI();
            GetCursorPos(out currentMousePoint);

            try
            {
                if (resizeRight)
                {
                    //如果当鼠标左键点下时,窗口的宽度已经达到最小值,
                    if (target.Width == minWidth)
                    {
                        //鼠标向右移动,表示当前是将窗口变大,此时窗口只能变大,因为已经达到最小宽度了
                        if ((target.Left+target.Width - currentMousePoint.X) < 0)
                        {
                            target.Width = this.target.Width - (target.Left + target.Width - currentMousePoint.X);
                        }
                    }
                    else
                    {
                        //此时,窗口可大可小
                        if ((this.target.Width - (target.Left + target.Width - currentMousePoint.X)) >= minWidth)
                        {
                            target.Width = this.target.Width - (target.Left + target.Width - currentMousePoint.X);
                        }
                        else
                        {
                            //此时,只能限制窗口为最小值,不能继续变小
                            target.Width = minWidth;
                        }
                    }
                }

                if (resizeDown)
                {
                    if (target.Height == minHeight)
                    {
                        if ((target.Top+target.Height - currentMousePoint.Y) < 0)
                        {
                            //限制窗口的最底端,不能低于任务栏,即不能被任务栏遮挡
                            if (workAreaMaxHeight > 0)
                            {
                                target.Height = (((target.Height - (target.Top + target.Height - currentMousePoint.Y)) + target.Top) <= workAreaMaxHeight) ? (target.Height - (target.Top + target.Height - currentMousePoint.Y)) : (workAreaMaxHeight - target.Top);
                            }
                            else
                            {
                                target.Height = target.Height - (target.Top + target.Height - currentMousePoint.Y);
                            }
                        }
                    }
                    else
                    {
                        if ((startWindowSize.Height - (startMousePoint.Y - currentMousePoint.Y)) >= minHeight)
                        {
                            if (workAreaMaxHeight > 0)
                            {
                                target.Height = (((startWindowSize.Height - (startMousePoint.Y - currentMousePoint.Y)) + target.Top) <= workAreaMaxHeight) ? (startWindowSize.Height - (startMousePoint.Y - currentMousePoint.Y)) : (workAreaMaxHeight - target.Top);
                            }
                            else
                            {
                                target.Height = startWindowSize.Height - (startMousePoint.Y - currentMousePoint.Y);
                            }
                        }
                        else
                        {
                            target.Height = minHeight;
                        }
                    }
                }

                if (resizeLeft)
                {
                    if (target.Width == minWidth)
                    {
                        if ((target.Left - currentMousePoint.X) > 0)
                        {
                            target.Width = target.Width + (target.Left - currentMousePoint.X);
                            target.Left = target.Left - (target.Left - currentMousePoint.X);
                        }
                    }
                    else
                    {
                        if ((this.target.Width + (target.Left - currentMousePoint.X)) >= minWidth)
                        {
                            target.Width = target.Width + (target.Left - currentMousePoint.X);
                            target.Left = target.Left - (target.Left - currentMousePoint.X);
                        }
                        else
                        {
                            target.Width = minWidth;
                        }
                    }
                }

                if (resizeUp)
                {
                    if (target.Height == minHeight)
                    {
                        if ((target.Top - currentMousePoint.Y) > 0)
                        {
                            target.Height = target.Height + (target.Top - currentMousePoint.Y);
                            target.Top = target.Top - (target.Top - currentMousePoint.Y);
                        }
                        else
                        {
                            target.Height = minHeight;
                        }
                    }
                    else
                    {
                        if ((target.Height + (target.Top - currentMousePoint.Y)) >= minHeight)
                        {
                            target.Height = target.Height + (target.Top - currentMousePoint.Y);
                            target.Top = target.Top - (target.Top - currentMousePoint.Y);
                        }
                        else
                        {
                            target.Height = minHeight;
                        }
                    }
                }
            }
            catch
            {
            }
        }
 static extern bool GetCursorPos(out PointAPI lpPoint);
 public static extern int GetCursorPos(ref PointAPI lpPoint);
示例#14
0
 static extern IntPtr GetCursorPos(out PointAPI lpPoint);
示例#15
0
        private void updateSize()
        {
            PointAPI p = new PointAPI();
            GetCursorPos(out p);

            if (resizeRight)
            {
                target.Width = Math.Max(0, this.resizeSize.Width - (resizePoint.X - p.X));
            }

            if (resizeDown)
            {
                target.Height = Math.Max(0, resizeSize.Height - (resizePoint.Y - p.Y));
            }

            if (resizeLeft)
            {
                target.Width = Math.Max(0, resizeSize.Width + (resizePoint.X - p.X));
                target.Left = Math.Max(0, resizeWindowPoint.X - (resizePoint.X - p.X));
            }

            if (resizeUp)
            {
                target.Height = Math.Max(0, resizeSize.Height + (resizePoint.Y - p.Y));
                target.Top = Math.Max(0, resizeWindowPoint.Y - (resizePoint.Y - p.Y));
            }
        }
示例#16
0
 static extern bool GetCursorPos(out PointAPI lpPoint);
示例#17
0
 private static extern int GetCursorPos(ref PointAPI p);
示例#18
0
 private void Server_ReloadedConfigs() => _spawnPointFile = PointAPI.GetPointList(SpawnPointFIleName);
 /* La string argument serve per la presenza di un eventuale DELTA in causa di presenza d'evento MOUSE WHEEL */
 private void doActionMouse(uint p, int delta)
 {
     PointAPI point = new PointAPI();
     GetCursorPos(out point);
     int X = point.X;
     int Y = point.Y;
     mouse_event(p, (uint)X, (uint)Y, delta, 0);
 }