位置: 编程技术 - 正文

unity里设置窗口大小和位置的代码(unity设置窗口位置)

编辑:rootadmin

推荐整理分享unity里设置窗口大小和位置的代码(unity设置窗口位置),希望有所帮助,仅作参考,欢迎阅读内容。

文章相关热门搜索词:unity的console窗口,unity的console窗口,unity的console窗口,unity怎么设置游戏窗口大小,unity设置窗口位置,unity设置窗口大小,unity设置窗口化,unity设置窗口大小,内容如对您有帮助,希望把文章链接给更多的朋友!

using System.Runtime.InteropServices;

#region DllImports[ DllImport("user.dll") ]public static extern int WindowFromPoint(int xPoint,int yPoint);[ DllImport("user.dll") ]public static extern int SetWindowPos(IntPtr hWnd, int hWndInsertAfter, int x, int y, int Width, int Height, int flags);

unity里设置窗口大小和位置的代码(unity设置窗口位置)

//参数分别是:x,y分别表示窗口左上角在屏幕的什么位置,width,height为0表示不改变窗口大小。[ DllImport("user.dll") ]public static extern int GetForegroundWindow();[ DllImport("user.dll") ]public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);[ DllImport("user.dll") ]public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow);[ DllImport("user.dll") ]public static extern int GetWindowText(int hwnd,string lpString,int cch); [DllImport("user.dll")] public static extern IntPtr GetActiveWindow(); [DllImport("user.dll")] public static extern bool SetForegroundWindow(IntPtr hWnd);[DllImport("user.dll")] public static extern long SetWindowLong(IntPtr hWnd,int nIndex,long dwNewLong);#endregion

IEnumerator forceRes () {yield return new WaitForSeconds(2);Screen.SetResolution(, , false);yield return new WaitForSeconds(2);SetWindowPos(GetActiveWindow(),-1,0,0,0,0,0x);}

Unity3d(C#)错误提示:禁止在线程中进行游戏对象比较! 今天刚刚写完异步Socket客户端的数据收发,在进行测试的时候,Unity报出错误:CompareBaseObjectsInternalcanonlybecalledfromthemainthread.详情如下:ERROR:CompareBaseObjec

unity连接数据库工具 这里只是我学习unity的一些笔记,有些是自己的总结,有些是请教的大神,有些是在网上查的资料(本来该给个链接的,临时也不好找,慢慢再补上)。

PHP 查询脚本 这里只是我学习unity的一些笔记,有些是自己的总结,有些是请教的大神,有些是在网上查的资料(本来该给个链接的,临时也不好找,慢慢再补上)。

本文链接地址:https://www.jiuchutong.com/biancheng/375823.html 转载请保留说明!

上一篇:unity自己项目总结出来的一些存储小技巧(1)PlayerPrefs小结(unity projector)

下一篇:Unity3d(C#)错误提示:禁止在线程中进行游戏对象比较!(unity错误cs1002)

免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

鄂ICP备2023003026号

网站地图: 企业信息 工商信息 财税知识 网络常识 编程技术

友情链接: 武汉网站建设 电脑维修 湖南楚通运网络