当前第2页 返回上一页
然后是最重要的委托GetSaveName()方法:
1 2 3 4 5 | public class DllUse
{
[DllImport( "Comdlg32.dll" , SetLastError = true , ThrowOnUnmappableChar = true , CharSet = CharSet.Auto)]
public static extern bool GetSaveFileName([In, Out] OpenFileName ofn);
}
|
挡挡挡,最后调用一下即可:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | public static void OpenDialog(Action<Stream> onSave)
{
OpenFileName ofn = new OpenFileName();
ofn.structSize = Marshal.SizeOf(ofn);
ofn.filter = "Excel (*.xls)\0*.xls\0\0" ;
ofn.file = new string( new char[256]);
ofn.maxFile = ofn.file.Length;
ofn.fileTitle = new string( new char[64]);
ofn.maxFileTitle = ofn.fileTitle.Length;
ofn.initialDir = UnityEngine.Application.dataPath;
ofn.defExt = ".xls" ;
{
dosomething();string Savepath = Path.GetDirectoryName (ofn.file);
Process.Start (Savepath);
}
}
|


终于搞定保存对话框汉化了,5555,也是不容易啊!
那位小伙伴有更好的方法希望可以分享给我啊!
以上就是Unity C# GetSaveFileName()的实例详解的详细内容!
返回前面的内容
相关阅读 >>
c#如何使用libusbdotnet实现usb通信的示例详解
.net 1.x中的委托实例详解
比较.net中接口与类的区别
c#中关于list<t>的并集与交集以及差集解析
c#中.net框架的简介
.net core创建一个控制台(console)程序
c# .net 将list序列化
.net?framework?4.5?五个很棒的特性分享
.net core对mongodb执行多条件查询
c#如何使用键值对取代switch...case语句的示例
更多相关阅读请进入《GetSaveFileName》频道 >>
清华大学出版社
作者:[美]克里斯琴·内格尔(Christian Nagel)著。出版时间:2019年3月。
转载请注明出处:木庄网络博客 » Unity C# GetSaveFileName()的实例详解