如何在Windows 8 metro應用程序中獲取窗口的尺寸?在Metro應用程序中獲取窗口尺寸
我想填補一個canvas元素的屏幕,目前我的default.js
文件看起來像這樣
// ... some autogenerated code ...
app.onactivated = function (args) {
if (args.detail.kind === activation.ActivationKind.launch) {
// ... some autogenerated code ...
var canvas = document.getElementById("myCanvas");
var context = canvas.getContext("2d");
canvas.width = 600; // I want to set width and height here so that
canvas.height = 800; // canvas fills the entire screen/window.
};
// ... more autogenerated code ...
如果你使用JQuery,這隻會工作。 window.outerWidth/outerHeight是你需要的 – 2012-07-24 15:26:14