Unity exe去掉边框
来源:互联网 发布:c 数据采集系统源代码 编辑:程序博客网 时间:2024/06/05 05:26
有时用unity发布exe,但是不希望有系统自带的那个最小化,关闭的的边框,下面就来了:
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
阅读全文
0 0
- Unity exe去掉边框
- Unity3D 去掉 exe 边框
- unity3d发布EXE去掉边框
- Unity3d 去掉exe版本的边框
- Unity3d 去掉exe版本的边框
- Unity3d 去掉exe版本的边框
- 【Unity3D自学记录】Unity3D去掉exe版本的边框
- Unity打包exe去边框,置顶,透明,透明穿透解决方案
- Unity发布成exe文件,去掉分辨率选择窗口
- IFrame 框架去掉边框
- javascript flash去掉边框
- 去掉panel的边框
- CSS去掉TextBox边框
- 去掉菜单的边框
- GridView去掉边框
- 去掉窗口边框
- 去掉input text边框
- CHtmlView 去掉边框
- Oracle 管理优化器的统计信息之系统统计信息 System Statistics
- MVVM架构简单使用
- AndroidGson 解析Json格式的数据
- android window manager
- BZOJ3505 数三角形 题解 【数论】
- Unity exe去掉边框
- 从0开始创建FX3工程之四
- 70. Climbing Stairs
- commons-codec的简易理解
- 前端开发接口联调--用nginx的反向代理机制解决前端跨域问题
- Hive中对数据库,表的操作
- 微信小程序 Node.js (基础九) 函数
- HashMap是数组+链表+红黑树(JDK1.8增加了红黑树部分)
- 237. Delete Node in a Linked List