public void MoveWindow(int marginLeft, int marginTop, int width, int height) { if (!this.IsLoaded) { return; } if (width < 0) { width = 0; } if (_marginLeft == marginLeft && _marginTop == marginTop && _height == height && _width == width) { return; } _marginLeft = marginLeft; _marginTop = marginTop; _height = height; _width = width; // 如果没有ConsoleBgRectangle的话鼠标会点击到桌面上 if (ConsoleBgRectangle.Width != width) { ConsoleBgRectangle.Width = width; } if (ConsoleBgRectangle.Height != height) { ConsoleBgRectangle.Height = height; } if ((int)ConsoleBgRectangle.Margin.Top != marginTop) { ConsoleBgRectangle.Margin = new Thickness(0, marginTop, 1, 0); } NTMinerConsole.MoveWindow(marginLeft, marginTop, width, height, true); }
public void MoveWindow(int marginLeft, int marginTop, int width, int height) { if (!this.IsLoaded) { return; } if (width < 0) { width = 0; } if (_marginLeft == marginLeft && _marginTop == marginTop && _height == height && _width == width) { return; } var rect = Microsoft.Windows.Shell.Standard.DpiHelper.LogicalRectToDevice(new Rect(marginLeft, marginTop, width, height)); marginLeft = (int)rect.Left; marginTop = (int)rect.Top; width = (int)rect.Width; height = (int)rect.Height; _marginLeft = marginLeft; _marginTop = marginTop; _height = height; _width = width; NTMinerConsole.MoveWindow(marginLeft, marginTop, width, height, true); }
private void ReSizeConsoleWindow() { IntPtr console = NTMinerConsole.Show(); Point point = ConsoleRectangle.TransformToAncestor(this).Transform(new Point(0, 0)); if (_isFirst) { IntPtr parent = new WindowInteropHelper(this).Handle; NativeMethods.SetParent(console, parent); NativeMethods.SetWindowLong(console, NativeMethods.GWL_STYLE, NativeMethods.WS_VISIBLE); _isFirst = false; } int width = (int)ConsoleRectangle.ActualWidth - 1; int height = (int)ConsoleRectangle.ActualHeight; NTMinerConsole.MoveWindow(console, (int)point.X, (int)point.Y, width, height, true); }
public void MoveWindow(int marginLeft, int marginTop, int width, int height) { if (!this.IsLoaded) { return; } if (width < 0) { width = 0; } if (_marginLeft == marginLeft && _marginTop == marginTop && _height == height && _width == width) { return; } _marginLeft = marginLeft; _marginTop = marginTop; _height = height; _width = width; NTMinerConsole.MoveWindow(marginLeft, marginTop, width, height, true); }