Error[8]: Undefined offset: 3, File: /www/wwwroot/outofmemory.cn/tmp/plugin_ss_superseo_model_superseo.php, Line: 121
File: /www/wwwroot/outofmemory.cn/tmp/plugin_ss_superseo_model_superseo.php, Line: 473, decode(

概述Unity C# GetSaveFileName()的实例详解 唉哟,这次厉害咯,网上搜罗了好久,终于被我找到汉化的保存对话框了,根据网上的一些前辈总结的内容,做了一些修改,

先放个效果图:

首先需要定义一个Openfilename的类:

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.auto)]public class Openfilename{	public int structSize = 0;	public IntPtr dlgOwner = IntPtr.Zero;	public IntPtr instance = IntPtr.Zero;	public String filter = null;	public String customFilter = null;	public int maxCustFilter = 0;	public int filterIndex = 0;	public String file = null;	public int maxfile = 0;	public String fileTitle = null;	public int maxfileTitle = 0;	public String initialDir = null;	public String Title = null;	public int flags = 0;	public short fileOffset = 0;	public short fileExtension = 0;	public String defExt = null;	public IntPtr custData = IntPtr.Zero;	public IntPtr hook = IntPtr.Zero;	public String templatename = null;	public IntPtr reservedPtr = IntPtr.Zero;	public int reservedInt = 0;	public int flagsEx = 0;}

  当然,也不是都用到了,只用到了一小部分,有性趣的童鞋可以个性化一下保存对话框,

然后是最重要的委托GetSavename()方法:

public class DllUse{	[Dllimport("Comdlg32.dll", SetLastError = true, ThrowOnUnmappableChar = true, CharSet = CharSet.auto)]	public static extern bool GetSavefilename([In, Out] Openfilename ofn);}

  挡挡挡,最后调用一下即可:

public static voID OpenDialog(Action<Stream> onSave)    {        Openfilename ofn = new Openfilename();        ofn.structSize = Marshal.SizeOf(ofn);            ofn.filter = "Excel (*.xls)[+++]*.xls[+++][+++]";        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.Title = "保存文件";        ofn.defExt = ".xls";//显示文件的类型ofn.flags = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000200 | 0x00000008;if (DllTest.GetSavefilename(ofn))        {            dosomething();string Savepath = Path.GetDirectoryname (ofn.file);            Process.Start (Savepath);        }    }

终于搞定保存对话框汉化了,5555,也是不容易啊!

那位小伙伴有更好的方法希望可以分享给我啊! 总结

以上是内存溢出为你收集整理的Unity C# GetSaveFileName()的实例详解全部内容,希望文章能够帮你解决Unity C# GetSaveFileName()的实例详解所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

)
File: /www/wwwroot/outofmemory.cn/tmp/route_read.php, Line: 126, InsideLink()
File: /www/wwwroot/outofmemory.cn/tmp/index.inc.php, Line: 165, include(/www/wwwroot/outofmemory.cn/tmp/route_read.php)
File: /www/wwwroot/outofmemory.cn/index.php, Line: 30, include(/www/wwwroot/outofmemory.cn/tmp/index.inc.php)
Error[8]: Undefined offset: 4, File: /www/wwwroot/outofmemory.cn/tmp/plugin_ss_superseo_model_superseo.php, Line: 121
File: /www/wwwroot/outofmemory.cn/tmp/plugin_ss_superseo_model_superseo.php, Line: 473, decode(

概述Unity C# GetSaveFileName()的实例详解 唉哟,这次厉害咯,网上搜罗了好久,终于被我找到汉化的保存对话框了,根据网上的一些前辈总结的内容,做了一些修改,

先放个效果图:

首先需要定义一个Openfilename的类:

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.auto)]public class Openfilename{	public int structSize = 0;	public IntPtr dlgOwner = IntPtr.Zero;	public IntPtr instance = IntPtr.Zero;	public String filter = null;	public String customFilter = null;	public int maxCustFilter = 0;	public int filterIndex = 0;	public String file = null;	public int maxfile = 0;	public String fileTitle = null;	public int maxfileTitle = 0;	public String initialDir = null;	public String Title = null;	public int flags = 0;	public short fileOffset = 0;	public short fileExtension = 0;	public String defExt = null;	public IntPtr custData = IntPtr.Zero;	public IntPtr hook = IntPtr.Zero;	public String templatename = null;	public IntPtr reservedPtr = IntPtr.Zero;	public int reservedInt = 0;	public int flagsEx = 0;}

  当然,也不是都用到了,只用到了一小部分,有性趣的童鞋可以个性化一下保存对话框,

然后是最重要的委托GetSavename()方法:

public class DllUse{	[Dllimport("Comdlg32.dll", SetLastError = true, ThrowOnUnmappableChar = true, CharSet = CharSet.auto)]	public static extern bool GetSavefilename([In, Out] Openfilename ofn);}

  挡挡挡,最后调用一下即可:

public static voID OpenDialog(Action<Stream> onSave)    {        Openfilename ofn = new Openfilename();        ofn.structSize = Marshal.SizeOf(ofn);            ofn.filter = "Excel (*.xls)*.xls[+++][+++]";        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.Title = "保存文件";        ofn.defExt = ".xls";//显示文件的类型ofn.flags = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000200 | 0x00000008;if (DllTest.GetSavefilename(ofn))        {            dosomething();string Savepath = Path.GetDirectoryname (ofn.file);            Process.Start (Savepath);        }    }

终于搞定保存对话框汉化了,5555,也是不容易啊!

那位小伙伴有更好的方法希望可以分享给我啊! 总结

以上是内存溢出为你收集整理的Unity C# GetSaveFileName()的实例详解全部内容,希望文章能够帮你解决Unity C# GetSaveFileName()的实例详解所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

)
File: /www/wwwroot/outofmemory.cn/tmp/route_read.php, Line: 126, InsideLink()
File: /www/wwwroot/outofmemory.cn/tmp/index.inc.php, Line: 165, include(/www/wwwroot/outofmemory.cn/tmp/route_read.php)
File: /www/wwwroot/outofmemory.cn/index.php, Line: 30, include(/www/wwwroot/outofmemory.cn/tmp/index.inc.php)
Error[8]: Undefined offset: 5, File: /www/wwwroot/outofmemory.cn/tmp/plugin_ss_superseo_model_superseo.php, Line: 121
File: /www/wwwroot/outofmemory.cn/tmp/plugin_ss_superseo_model_superseo.php, Line: 473, decode(

概述Unity C# GetSaveFileName()的实例详解 唉哟,这次厉害咯,网上搜罗了好久,终于被我找到汉化的保存对话框了,根据网上的一些前辈总结的内容,做了一些修改,

先放个效果图:

首先需要定义一个Openfilename的类:

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.auto)]public class Openfilename{	public int structSize = 0;	public IntPtr dlgOwner = IntPtr.Zero;	public IntPtr instance = IntPtr.Zero;	public String filter = null;	public String customFilter = null;	public int maxCustFilter = 0;	public int filterIndex = 0;	public String file = null;	public int maxfile = 0;	public String fileTitle = null;	public int maxfileTitle = 0;	public String initialDir = null;	public String Title = null;	public int flags = 0;	public short fileOffset = 0;	public short fileExtension = 0;	public String defExt = null;	public IntPtr custData = IntPtr.Zero;	public IntPtr hook = IntPtr.Zero;	public String templatename = null;	public IntPtr reservedPtr = IntPtr.Zero;	public int reservedInt = 0;	public int flagsEx = 0;}

  当然,也不是都用到了,只用到了一小部分,有性趣的童鞋可以个性化一下保存对话框,

然后是最重要的委托GetSavename()方法:

public class DllUse{	[Dllimport("Comdlg32.dll", SetLastError = true, ThrowOnUnmappableChar = true, CharSet = CharSet.auto)]	public static extern bool GetSavefilename([In, Out] Openfilename ofn);}

  挡挡挡,最后调用一下即可:

public static voID OpenDialog(Action<Stream> onSave)    {        Openfilename ofn = new Openfilename();        ofn.structSize = Marshal.SizeOf(ofn);            ofn.filter = "Excel (*.xls)*.xls[+++]";        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.Title = "保存文件";        ofn.defExt = ".xls";//显示文件的类型ofn.flags = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000200 | 0x00000008;if (DllTest.GetSavefilename(ofn))        {            dosomething();string Savepath = Path.GetDirectoryname (ofn.file);            Process.Start (Savepath);        }    }

终于搞定保存对话框汉化了,5555,也是不容易啊!

那位小伙伴有更好的方法希望可以分享给我啊! 总结

以上是内存溢出为你收集整理的Unity C# GetSaveFileName()的实例详解全部内容,希望文章能够帮你解决Unity C# GetSaveFileName()的实例详解所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

)
File: /www/wwwroot/outofmemory.cn/tmp/route_read.php, Line: 126, InsideLink()
File: /www/wwwroot/outofmemory.cn/tmp/index.inc.php, Line: 165, include(/www/wwwroot/outofmemory.cn/tmp/route_read.php)
File: /www/wwwroot/outofmemory.cn/index.php, Line: 30, include(/www/wwwroot/outofmemory.cn/tmp/index.inc.php)
Unity C# GetSaveFileName()的实例详解_C_内存溢出

Unity C# GetSaveFileName()的实例详解

Unity C# GetSaveFileName()的实例详解,第1张

概述Unity C# GetSaveFileName()的实例详解 唉哟,这次厉害咯,网上搜罗了好久,终于被我找到汉化的保存对话框了,根据网上的一些前辈总结的内容,做了一些修改,

先放个效果图:

首先需要定义一个Openfilename的类:

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.auto)]public class Openfilename{	public int structSize = 0;	public IntPtr dlgOwner = IntPtr.Zero;	public IntPtr instance = IntPtr.Zero;	public String filter = null;	public String customFilter = null;	public int maxCustFilter = 0;	public int filterIndex = 0;	public String file = null;	public int maxfile = 0;	public String fileTitle = null;	public int maxfileTitle = 0;	public String initialDir = null;	public String Title = null;	public int flags = 0;	public short fileOffset = 0;	public short fileExtension = 0;	public String defExt = null;	public IntPtr custData = IntPtr.Zero;	public IntPtr hook = IntPtr.Zero;	public String templatename = null;	public IntPtr reservedPtr = IntPtr.Zero;	public int reservedInt = 0;	public int flagsEx = 0;}

  当然,也不是都用到了,只用到了一小部分,有性趣的童鞋可以个性化一下保存对话框,

然后是最重要的委托GetSavename()方法:

public class DllUse{	[Dllimport("Comdlg32.dll", SetLastError = true, ThrowOnUnmappableChar = true, CharSet = CharSet.auto)]	public static extern bool GetSavefilename([In, Out] Openfilename ofn);}

  挡挡挡,最后调用一下即可:

public static voID OpenDialog(Action<Stream> onSave)    {        Openfilename ofn = new Openfilename();        ofn.structSize = Marshal.SizeOf(ofn);            ofn.filter = "Excel (*.xls)*.xls";        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.Title = "保存文件";        ofn.defExt = ".xls";//显示文件的类型ofn.flags = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000200 | 0x00000008;if (DllTest.GetSavefilename(ofn))        {            dosomething();string Savepath = Path.GetDirectoryname (ofn.file);            Process.Start (Savepath);        }    }

终于搞定保存对话框汉化了,5555,也是不容易啊!

那位小伙伴有更好的方法希望可以分享给我啊! 总结

以上是内存溢出为你收集整理的Unity C# GetSaveFileName()的实例详解全部内容,希望文章能够帮你解决Unity C# GetSaveFileName()的实例详解所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/1212235.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-04
下一篇 2022-06-04

发表评论

登录后才能评论

评论列表(0条)

保存