コード例 #1
0
ファイル: OpenFile.cs プロジェクト: foozc/ScriptArchive
    public void OpenFileDiaLog(Action <string> action)
    {
        OpenFileDialogTest ofn = new OpenFileDialogTest();

        ofn.structSize = Marshal.SizeOf(ofn);
        //ofn.filter = "三菱(*.gxw)\0*.gxw\0西门子(*.mwp)\0*.mwp\0All Files\0*.*\0\0";
        ofn.filter       = fileSuffix;
        ofn.file         = new string(new char[256]);
        ofn.maxFile      = ofn.file.Length;
        ofn.fileTitle    = new string(new char[64]);
        ofn.maxFileTitle = ofn.fileTitle.Length;
        string path = Application.streamingAssetsPath;

        path           = path.Replace('/', '\\');//默认路径
        ofn.initialDir = path;
        ofn.title      = openWindowName;
        //ofn.defExt = "JPG";//显示文件的类型
        ofn.flags = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000200 | 0x00000008;        //OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST| OFN_ALLOWMULTISELECT|OFN_NOCHANGEDIR
        if (WindowDll.GetOpenFileName(ofn))
        {
            if (action != null)
            {
                action(ofn.file);
            }
        }
    }
コード例 #2
0
ファイル: OpenFile.cs プロジェクト: foozc/ScriptArchive
 public static bool GetOpenFileName1([In, Out] OpenFileDialogTest ofn)
 {
     return(GetOpenFileName(ofn));
 }
コード例 #3
0
ファイル: OpenFile.cs プロジェクト: foozc/ScriptArchive
 public static extern bool GetOpenFileName([In, Out] OpenFileDialogTest ofn);