Esempio n. 1
0
        public static string OpenFile(string path)
        {
            OpenFileName ofn = new OpenFileName();

            ofn.structSize   = Marshal.SizeOf(ofn);
            ofn.filter       = "PPTX(*.pptx)\0*.pptx\0;ppt(*.ppt)\0*.ppt\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   = path;
            ofn.title        = "打开";
            ofn.defExt       = "pptx;ppt";
            if (GetOpenFileName(ofn))
            {
                //openFileFlat = 1;
                return(ofn.file);
            }
            return("");
        }
Esempio n. 2
0
        public static string SaveFile(string filepath, string filename)
        {
            OpenFileName ofn = new OpenFileName();

            ofn.structSize = Marshal.SizeOf(ofn);
            ofn.filter     = "PNG(*.png)\0*.png\0";
            //ofn.file = new String(new char[256]);
            char[] name = new char[256];
            Array.Copy(filename.ToCharArray(), name, filename.Length);
            ofn.file         = new String(name);
            ofn.maxFile      = ofn.file.Length;
            ofn.fileTitle    = new String(new char[64]);
            ofn.maxFileTitle = ofn.fileTitle.Length;
            ofn.initialDir   = filepath;
            ofn.title        = "保存";
            ofn.defExt       = "PNG";
            if (GetSaveFileName(ofn))
            {
                return(ofn.file);
            }
            return("");
        }
Esempio n. 3
0
 public static extern bool GetSaveFileName([In, Out] OpenFileName ofn);