0
点赞
收藏
分享

微信扫一扫

electron 获取屏幕


获取屏幕

注意需要在 new 之后获取

import { BrowserWindow, screen } from'electron';

const win = new BrowserWindow({
width: screen.getPrimaryDisplay().workAreaSize.width,
height: screen.getPrimaryDisplay().workAreaSize.height,
webPreferences: {
nodeIntegration: true
}
});

const {BrowserWindow, screen} = require('electron');

let window = new BrowserWindow();

// Load a URL and show the window first

const winBounds = window.getBounds();
const whichScreen = screen.getDisplayNearestPoint({x: winBounds.x, y: winBounds.y});
// Returns the screen where your window is located


举报

相关推荐

0 条评论