java界面太小 win10_Windows 10 UWP应用程序 - 在桌面上设置窗口大小

嗨我有你的问题的解决方案,问题是你没有真正控制窗口大小,即使你会尝试重新调整它的大小,它可能会失败 . 我在msdn论坛上问了同样的问题并得到了答案

顺便说一下这里是您的事件处理程序“OnLaunched”或您的事件处理程序“OnActivated”中的解决方案:

Window.Current.Activate();

并替换为:

float DPI = Windows.Graphics.Display.DisplayInformation.GetForCurrentView().LogicalDpi;

Windows.UI.ViewManagement.ApplicationView.PreferredLaunchWindowingMode = Windows.UI.ViewManagement.ApplicationViewWindowingMode.PreferredLaunchViewSize;

var desiredSize = new Windows.Foundation.Size(((float)800 * 96.0f / DPI), ((float)600 * 96.0f / DPI));

Windows.UI.ViewManagement.ApplicationView.PreferredLaunchViewSize = desiredSize;

Window.Current.Activate();

bool result = Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().TryResizeView(desiredSize);

如果将此代码放入“OnActivated()”事件处理程序中会更好,因为它会在应用程序启动时以及在任何中断后变为活动时设置您定义的大小 .

在“desiredSize”中,计算800是宽度,600是高度需要此计算,因为大小是DPI,因此您必须将其从像素转换为DPI

另请注意,尺寸不能小于“320x200”

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
用于游戏窗口大小调整AltDrag Made by Stefan Sundin Drag windows with the mouse when pressing the alt key. You can use the middle or right mouse button to resize windows. If you press the shift key while you drag or resize, the window will stick to other windows. You can double-click a window to maximize it. You can double-click with the middle mouse button to roll-up windows. You can edit more settings in AltDrag.ini: * Enable experimental features to be able to use the shift key when normally moving windows. * Enable StickyScreen to make windows always sticky to the screen borders and the taskbar when dragging or resizing (no need to press shift). Fullscreen windows, such as games, will not be dragged or resized. If you experience lag when you move or resize windows, try disabling the mouse cursor switch in AltDrag.ini. AltDrag will automatically check for updates. You can disable this in AltDrag.ini. You can use -hide as a parameter to hide the tray icon. Visit the website at http://altdrag.googlecode.com/ Send feedback to recover89@gmail.com If you feel this program is useful, please consider donating money. You can find out how to donate on the website. Changelog --------- 0.7 - 2009-04-24: Added StickyScreen which makes windows automatically stick to the screen borders without needing shift (off by default). Added the ability to roll-up windows by double-clicking with the middle mouse button. Fixed some bugs in ExperimentalFeatures, it's working pretty well now so give it a try. Fixed an annoying error message that sometimes popped up when AltDrag was on autostart. 0.6 - 2009-02-12: Sticky behavior now works with resize (except when resizing in all directions). Fixed tray not being hidden by -hide. Fixed mouse cursor not changing when Aero was disabled in Vista. Language can now be changed in AltDrag.ini. 0.5 - 2009-01-12: You can now resize windows with the middle or right mouse button. You can now double-click a window to maximize it. You can now blacklist cert

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值