Unity exe去掉边框
2017-07-05 14:51
447 查看
有时用unity发布exe,但是不希望有系统自带的那个最小化,关闭的的边框,下面就来了:
效果图
参考文章:
1、http://www.360doc.com/content/16/0620/14/30388632_569261323.shtml
2、http://blog.csdn.net/awnuxcvbn/article/details/38545419
using System; using System.Collections; using System.Collections.Generic; using System.Runtime.InteropServices; using UnityEngine; public class WindowRemoveBorder : MonoBehaviour { public Rect screenPosition; [DllImport("user32.dll")] static extern IntPtr SetWindowLong(IntPtr hwnd, int _nIndex, int dwNewLong); [DllImport("user32.dll")] static extern bool SetWindowPos(IntPtr hWnd, int hWndInserAfter, int X, int Y, int cx, int cy, uint uFlags); [DllImport("user32.dll")] static extern IntPtr GetForegroundWindow(); [DllImport("User32.dll", EntryPoint = "GetSystemMetrics")] public static extern IntPtr GetSystemMetrics(int nIndex); const int SM_CXSCREEN = 0x00000000; const int SM_CYSCREEN = 0x00000001; const uint SWP_SHOWWINDOW = 0x0040; const int GWL_STYLE = -16; const int WS_BORDER = 1; const int WS_POPUP = 0x800000; void Start() { //当前屏幕分辨率 int resWidth = (int)GetSystemMetrics(SM_CXSCREEN); int resHeight = (int)GetSystemMetrics(SM_CYSCREEN); //窗体的宽高 screenPosition.width = Screen.width; screenPosition.height = Screen.height; //设置窗体的位置 screenPosition.x = resWidth / 2 - screenPosition.width / 2; screenPosition.y = resHeight / 2 - screenPosition.height / 2; //将网上的WS_BORDER替换成WS_POPUP SetWindowLong(GetForegroundWindow(), GWL_STYLE, WS_POPUP); bool result = SetWindowPos(GetForegroundWindow(), 0, (int)screenPosition.x, (int)screenPosition.y, (int)screenPosition.width, (int)screenPosition.height, SWP_SHOWWINDOW); } }
效果图
参考文章:
1、http://www.360doc.com/content/16/0620/14/30388632_569261323.shtml
2、http://blog.csdn.net/awnuxcvbn/article/details/38545419
相关文章推荐
- unity中打包的exe时去掉对话框的设置
- Unity发布成exe文件,去掉分辨率选择窗口
- Unity3d 去掉exe版本的边框
- Unity3d 去掉exe版本的边框
- Unity打包exe去边框,置顶,透明,透明穿透解决方案
- Unity3D 去掉 exe 边框
- Unity3d 去掉exe版本的边框
- Unity3d 去掉exe版本的边框
- 【Unity3D自学记录】Unity3D去掉exe版本的边框
- 终于去掉了seagent.exe和SSystem.exe
- 怎么用css去掉chrome浏览器中input获得焦点时的带颜色边框呢
- QT5 将QDocWidget的上边框去掉
- 如何去掉热区的边框!
- 去掉A标签的点击选中边框
- unity .exe文件打开时跳过选择窗口界面的方式
- 如何去掉自定义dialog的背景与边框?
- Unity中如果去掉脚本的勾选框
- UITableView去掉Grouped样式中的边框
- 商务通去掉四周的边框 好像定制一样实现方法
- qaxwidget去掉网页上的边框